Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Posts
    12

    Unanswered: 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?

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    grep -v 'successful' *
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  3. #3
    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 10:59. Reason: command didn't work afterall

  4. #4
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •