0

I thought that maybe grep -v "<ignore file with this text>" $(ls) might work, but it ends up returning every single line within each file that does not match the text. What I want is for the file to be ignored if it contains any number of matches. As follows

Input

file1<-- matches
file2
file3<-- matches
file4<-- matches
file5

Output

file2
file5
Kalcifer
  • 1,211
  • 12
  • 18

1 Answers1

0

Use the -l (lower case L) option with -v invert match.

-l, --files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed.

grep -vl "<ignore file with this text>" $(ls)

OR

Use the -L (upper case L) option

-L, --files-without-match Suppress normal output; instead print the name of each input file from which no output would normally have been printed.

grep -L "<ignore file with this text>" $(ls)

ap-osd
  • 2,624
  • 16
  • 16