![]() |
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 |
| If conditional | abhinavsinha | Shell Programming and Scripting | 12 | 11-03-2008 06:30 AM |
| If conditional | abhinavsinha | UNIX for Dummies Questions & Answers | 1 | 10-31-2008 01:48 AM |
| Conditional FTP | Dastard | Shell Programming and Scripting | 2 | 06-21-2008 07:38 AM |
| conditional ftp | dr46014 | UNIX for Dummies Questions & Answers | 3 | 06-20-2008 11:00 AM |
| AWK - conditional cause | Rafael.Buria | Shell Programming and Scripting | 2 | 01-28-2008 01:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
conditional extracting
Hi,
I need to extract lines based on some conditions as explained below: File format details: 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, i need to extract only the lines starting with AAA and BBB only. The condition is to pick AAA and BBB if and only if both exist in the same data set. For. e.g, i have data for 4 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,l,m AAA,4,w,x,y,z CCC,4,p,q,r,s then the output must be AAA,1,a,b,c,d BBB,1,j,k,l,m AAA,2,j,k,l,m BBB,2,a,b,c,d AAA,3,w,x,y,z BBB,3,j,k,l,m (Pl note there is no 4th data set in the output as 4th data set has no BBB) Please advise. Thanks Prvn |
|
||||
|
Thank you Franklin.
Your solution worked great! Prvn |
| Sponsored Links | ||
|
|