![]() |
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 |
| using AWK see the upper lines and lower lines of the strings?? | thepurple | Shell Programming and Scripting | 3 | 10-07-2008 10:24 AM |
| How to delete first 5 lines and last five lines in all text files | ragavendran31 | Shell Programming and Scripting | 10 | 02-21-2008 07:58 AM |
| How to print only lines in between two strings using awk | jisha | Shell Programming and Scripting | 4 | 01-11-2008 04:13 AM |
| How to count lines - ignoring blank lines and commented lines | kthatch | UNIX for Dummies Questions & Answers | 6 | 05-25-2007 01:21 AM |
| delete blank lines or lines with spaces only | vascobrito | UNIX for Dummies Questions & Answers | 3 | 01-13-2004 07:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Grep and delete lines except the lines with strings
Hi
I am writing a script which should read a file and search for certain strings 'approved' or 'removed' and retain only those lines that contain the above strings. Ex: file name 'test' test: Code:
approved package waiting for approval package disapproved package removed package approved package approved package How can i do that. Last edited by Yogesh Sawant; 04-20-2009 at 03:53 AM.. Reason: added code tags |
|
||||
|
Code:
$ cat test approved package waiting for approval package disapproved package removed package approved package approved package $ egrep -E 'approved|removed' test approved package disapproved package removed package approved package approved package |
|
||||
|
Thank you ... but i have two problems
1) egrep -E does not work. it returns 'Invalid options' 2) as per the above command 'disapproved' is not removed from file i want that line also to be removed with 'removed' or 'approved' string option. |
|
||||
|
sir,
i get the reply as Code:
sed: illegal option -- i Last edited by Yogesh Sawant; 04-20-2009 at 03:54 AM.. Reason: added code tags |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| egrep or, sed regex |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|