![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ksh pattern matching | ripat | Shell Programming and Scripting | 5 | 02-10-2008 04:44 PM |
| pattern matching in an if-then | lumix | Shell Programming and Scripting | 4 | 12-14-2007 04:25 PM |
| Pattern Matching | op4_u | Shell Programming and Scripting | 10 | 07-18-2006 12:30 AM |
| Pattern matching sed | leemjesse | Shell Programming and Scripting | 3 | 03-23-2005 04:06 AM |
| Pattern Matching | danhodges99 | UNIX for Dummies Questions & Answers | 2 | 02-27-2003 03:03 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Pattern matching
I have a file containing records;
FTEFDF CC cdscsf GDGBFCS RR cscscs ASCCDDF WW jkkkuykhm NKN SS sdcscscsv My problem is to search through the entire document and extract the pair of records that contain RR and WW in the consecutive records at the second field position. The fields are separated by a space. Plz help!! Regards; BB. Last edited by blue_bird; 10-07-2008 at 12:30 PM.. |
|
||||
|
Works here. Do you get an error message? Do you have nawk / mawk / gawk that you could try instead of plain old awk? Try this, too (assuming there are always three fields, or that false matches are otherwise unlikely).
Code:
sed '/ RR /,/ WW /!d' file |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|