![]() |
|
|
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 |
| unable to filter out blank lines ^$ matches nothing | venkatkk | UNIX for Advanced & Expert Users | 5 | 02-08-2008 10:27 AM |
| how do I filter double lines from a txt file | I-1 | Shell Programming and Scripting | 10 | 02-20-2007 01:21 PM |
| need help--script to filter specific lines from multiple txt files | I-1 | Shell Programming and Scripting | 7 | 02-16-2007 08:42 PM |
| cutting unwanted text | sysgate | Shell Programming and Scripting | 2 | 11-29-2006 05:43 AM |
| creation of unwanted directory | mridula | High Level Programming | 6 | 10-05-2005 12:40 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Filter unwanted lines
Hi All,
I have the below input and i only want to filter out some un-wanted info from here. Expected output is below. Can somebody help ? The catch is that i want to grep those lines with term "k=" and lines with term "**" as the 1st column and "07" as the last column. And the number of unwanted lines in between the wanted lines are random. On top of that, the number of field of the wanted lines are also random. Expected output shown below. Input: aaa k= aaaa dddd dddd bbb k= cccc zzz zzz zzzzz ggg k= pppp vvvvvv vvv v vvvvv vvvvvv ** XXXXX ZZZ VVV 07 ** ccc kkk lll ** ggg lll ppp ** hhh iii kkk xxxxxx mmm k= qqqq xxxxx ddd eee k= yyyy ffff ff rrr k= vvvv ttt gggggg zzzzz Expected Output: aaa k= aaaa bbb k= cccc ggg k= pppp ** XXXXX ZZZ VVV 07 mmm k= qqqq eee k= yyyy rrr k= vvvv |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|