![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
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 |
| help need for pattern matching | HIMANI | UNIX for Dummies Questions & Answers | 10 | 01-22-2008 07:30 AM |
| Pattern Matching | op4_u | Shell Programming and Scripting | 10 | 07-18-2006 01:30 AM |
| grep - to exclude lines beginning with pattern | frustrated1 | Shell Programming and Scripting | 2 | 08-29-2005 08:18 AM |
| Pattern matching sed | leemjesse | Shell Programming and Scripting | 3 | 03-23-2005 04:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
exclude columns with a matching line pattern
Hi ,
I have 5 columns total and am wanting to search lines in columns 3-5 and basically grep -v patterns that match 'BBB_0123' 'BVG_0895' 'BSD_0987' Does anyone know how to do this? I tried combining grep -v with grep -e but, it didn't work. Thanks! |
|
||||
|
Still need a little more help....
I think I should explain a little more...
I want to exclude cases where there is information in all three columns (ie. BBB_0123 BVG_0895 BSD_0987 straight across) and only keep lines that have gaps : Thanks so much for your help! BBB_0123 BVG_0895 BSD_0987 BBB_0123 BVG_0895 BSD_0987 BBB_0123 BSD_0987 BBB_0123 BVG_0895 BVG_0895 BBB_0123 BVG_0895 BSD_0987 |
|
||||
|
Still need more help....
I think I should explain a little more...
I want to exclude cases where there is information in all three columns (ie. BBB_0123 BVG_0895 BSD_0987 straight across) and only keep lines that have gaps : Thanks so much for your help! BBB_0123 BVG_0895 BSD_0987 BBB_0123 BVG_0895 BSD_0987 BBB_0123 BSD_0987 BBB_0123 BVG_0895 BVG_0895 BBB_0123 BVG_0895 BSD_0987 |
|
|||||
|
I still don't understand, where are the five columns you talked about? Could you please provide a real input file and the expected output? If the input file is identical to the one you posted, you simply need: Code:
grep -v "BBB_0123 BVG_0895 BSD_0987" input_file.txt If you want to remove all the lines containing ALL three occurrences of the patterns, regardless of the patterns' order in the line, you may try this: Code:
awk '{
split("", x);
for (i=1;i<=NF;i++) x[$i]++;
if (!(x["BBB_0123"] && x["BVG_0895"] && x["BSD_0987"])) print;
}' input_file.txt
Use nawk if you're on Solaris OS. Last edited by robotronic; 06-30-2008 at 06:57 AM.. |
![]() |
| Bookmarks |
| Tags |
| solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|