Issue
I need all files with lines including the word "confidential" But not having this sentence "waste paper is confidential and need to be disposed"
grep confidential 100*.cvt
gives me lines that contain word "confidential"
How do I remove programs with this sentence "waste paper is confidential and need to be disposed"
grep confidential 100*.cvt | grep -v waste paper is confidential and need to be disposed 100*.cvt
Solution
Use grep -l
to get just the filenames from the first grep
. Then use that as the filename arguments to the second grep.
You also need to quote the pattern if it contains whitespace.
grep -l confidential 100*.cvt | xargs grep -l -v 'waste paper is confidential and need to be disposed'
Answered By - Barmar Answer Checked By - Marie Seifert (WPSolving Admin)