![]() |
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 |
| 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Grep question. | saurabhsinha23 | UNIX for Dummies Questions & Answers | 3 | 12-11-2007 01:58 AM |
| Question about GREP | Adriel | UNIX for Dummies Questions & Answers | 16 | 03-22-2007 08:03 AM |
| Another grep question | kingdbag | UNIX for Dummies Questions & Answers | 6 | 10-27-2006 01:56 AM |
| grep & sed question | der Kopf | Shell Programming and Scripting | 1 | 11-22-2004 04:49 AM |
| Grep question | eloquent99 | UNIX for Dummies Questions & Answers | 4 | 02-20-2003 10:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
grep question
I wanted to search a for all lines containing ERROR but not errors that contained the word "foo" (for example). The only way I could figure out to do it was:
grep ERROR myfile.log | grep -v foo is there a way to do this with one grep command instead of two? One grep is faster than two, especially for large files like log files. ![]() |
|
||||
|
radoulov, isn't "fgrep ERROR file|fgrep -v foo "-the same as doing "grep ERROR file | grep -v foo", except it uses fgrep instead of grep? Is there some advantage for fgrep in this case?
The awk thing is pretty cool - I tried it and it works great. I'll have to look into awk more - I know nothing about it (yet!). sanjustudy, I don't understand how grep -r "ERROR" * will do what I want. I thought "-r" was for searching directories recursively. Also, I don't see how it searches for "foo". |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|