![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extract the lines | prvnrk | Shell Programming and Scripting | 2 | 05-25-2008 07:17 AM |
| logic needed to extract lines | ganapati | UNIX for Dummies Questions & Answers | 2 | 01-10-2008 07:18 AM |
| extract column based on name | t27 | UNIX for Dummies Questions & Answers | 3 | 08-29-2007 02:04 PM |
| How to extract a sequence of n lines from a file | 0ktalmagik | Shell Programming and Scripting | 4 | 06-30-2006 12:24 AM |
| Extract known lines | nhatch | UNIX for Dummies Questions & Answers | 2 | 09-16-2004 12:59 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
extract lines based on few conditions
Hi,
I need to extract lines based on some conditions as explained below: File format details: notes: 1. each set starts with AAA only 2. number of columns is fixed 3. number of rows per set may vary (as one set is upto DDD - 4 rows) Now, if any BBB's 5th column is blank then then script should provide us it's AAA line. For. e.g, i have data for 3 sets and file has the below: AAA,1,a,b,c,d CCC,1,p,q,r,s BBB,1,j,k,l,m AAA,2,j,k,l,m BBB,2,a,b,c,d AAA,3,w,x,y,z CCC,3,p,q,r,s DDD,3,a,b,c,d BBB,3,j,k,,m then the output must be AAA,3,w,x,y,z I could extract the line that is missing by below: gawk -F"," '$1 == "BBB" && $5 == "" { print $0 }' /tmp/file but clueless how to get the AAA-line of it. Please advise. Thanks Prvn |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|