![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| null string matching in sed? | Allasso | Shell Programming and Scripting | 6 | 05-30-2008 04:44 PM |
| Matching string | nehaquick | UNIX for Dummies Questions & Answers | 7 | 02-19-2008 08:51 AM |
| sed problem - replacement string should be same length as matching string. | amangeles | Shell Programming and Scripting | 4 | 01-11-2006 03:11 AM |
| SED: Matching a string with whitespace? | cstovall | Shell Programming and Scripting | 1 | 06-07-2005 12:32 PM |
| matching alphanumeric string | sskb | Shell Programming and Scripting | 4 | 12-12-2001 07:48 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
String matching
for a certain directory, I want to grep a particular file called ABCD so what I do is
ls /my/dir | grep -i "ABCD" | awk '{print $9}' however, there is also this file called ABCDEFG, the above command would reurn both file when I only want ABCD, please help! |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Move the sed logic in awk :
Code:
ls -l /my/dir | awk 'toupper($9)=="ABCD" {print $9}'
Last edited by aigles; 07-28-2006 at 03:06 AM. |
|
#3
|
||||
|
||||
|
Or:
Quote:
|
|
#4
|
|||
|
|||
|
thanks you guys! you guys ROCK!
|
|||
| Google The UNIX and Linux Forums |