![]() |
|
|
grep unix.com with google
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Our 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 | Rate Thread | Display Modes |
|
|||
|
omit strings from grep result
Hi,
I know this is a really dumb question, and I used to know how to do this, but I forgot and I can't seem to find the command online anywhere: When I grep a string, how do I filter the results so that lines containing a certain string are OMITTED! for example: grep 'string' *.txt gives: 1. string computer computer computer 2. string face face face I only want the second line, I know I can do: grep 'string' *.txt | grep 'face' but I would like to be able to do something like: grep 'string' *.txt | ungrep 'computer' where 'ungrep' is just my name for the unknown command I'm seeking Thanks much! |
|
|||
|
or just: Code:
grep 'string' *.txt | grep -v computer ![]() ---------- Post updated at 16:19 ---------- Previous update was at 16:15 ---------- Code:
egrep -v "!(string)|computer" *.txt |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to negate grep result? | mmdawg | Shell Programming and Scripting | 4 | 05-05-2008 09:24 AM |
| diaplaying the grep result | rag84dec | Shell Programming and Scripting | 1 | 03-27-2008 02:37 AM |
| append a string to a grep result | melanie_pfefer | Shell Programming and Scripting | 8 | 03-19-2008 07:19 AM |
| grep to handle a 0 result | ocelot | UNIX for Dummies Questions & Answers | 6 | 02-05-2007 11:19 AM |
| To have a numeric result from grep | Hak Dee | UNIX for Dummies Questions & Answers | 2 | 08-07-2006 08:26 AM |