|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Deleting the unwanted data based on condition
hi i have my input data like this Code:
aaa bbb ccc asa dff nmj mnj saa dff oik aax cdx saa oik asq sdf dss i want my output file to be like this Code:
mnj saa dff oik aax cdx saa oik i want to retain only those lines which will have oik just below them and i want oik to be as next column to those lines in the output file |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Code:
awk '$0=="oik"{print p,$0}{p=$0;}' filename |
| The Following User Says Thank You to Yoda For This Useful Post: | ||
anurupa777 (01-26-2013) | ||
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with parsing data with awk , eliminating unwanted data | rveri | Shell Programming and Scripting | 5 | 01-06-2013 01:33 AM |
| deleting unwanted files solaris | jegaraman | Solaris | 1 | 06-07-2011 01:06 AM |
| Eliminate unwanted data | t524ube | Shell Programming and Scripting | 5 | 02-17-2009 05:46 PM |
| OS/X 10.4 Deleting unwanted applications | methyl | OS X (Apple) | 2 | 01-17-2009 12:35 PM |
| command for deleting log files based on some condition | pulkit | Shell Programming and Scripting | 4 | 01-09-2008 05:17 AM |
|
|