If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > How to find file that do not contain a specific string?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-09-04, 16:36
everpro everpro is offline
Registered User
 
Join Date: May 2004
Posts: 12
How to find file that do not contain a specific string?

Similar to grep but want to know the file names only of the files that do not contain the word "successful". Any ideas?
Reply With Quote
  #2 (permalink)  
Old 08-09-04, 16:53
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
grep -v 'successful' *
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #3 (permalink)  
Old 08-10-04, 09:52
everpro everpro is offline
Registered User
 
Join Date: May 2004
Posts: 12
grep -v displays all lines not matching the pattern and that r/o

includes the files that DO have the word successful..... because it displays all of the other lines in that file. Any other ideas?

Last edited by everpro; 08-10-04 at 09:59. Reason: command didn't work afterall
Reply With Quote
  #4 (permalink)  
Old 08-11-04, 13:27
everpro everpro is offline
Registered User
 
Join Date: May 2004
Posts: 12
I figured it out for anyone interested it is:

for i in `cat list` (where list is a list of files you are grepping)
do
if ! grep success $i > /dev/null
then
echo "$i"
fi
done
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On