user3518712
user3518712

Reputation:

How to make grep list strings not found in a file

I have list of a strings in a file and want grep to search for them in another file and print only the strings which were not found. Is it possible?

Upvotes: 2

Views: 460

Answers (1)

Barmar
Barmar

Reputation: 781096

while read string
do
    if ! grep -q "$string" "$other_file"
    then echo "$string"
    fi
done < "$file"

Upvotes: 1

Related Questions