-5

Hello I have file with filesnames, it looks like:

names.txt:

first.html
second.html
third.html

I need to search trough all that files and return those which does not contain a pattern. How can I do that.

hek2mgl
  • 152,036
  • 28
  • 249
  • 266
rzeznik
  • 71
  • 2
  • 7

1 Answers1

0

grep accepts multiple files as input, and the option you're looking for is -L

$ grep -L pattern $(cat filenames.txt)

Example:

$ cat filenames.txt
first.html
second.html
third.html

$ cat first.html

2

4
$ cat second.html
1
2
3
4
5
$ cat third.html
4
5
6
7
8
9
10
$ grep -L 2 $(cat filenames.txt)
third.html
karakfa
  • 66,216
  • 7
  • 41
  • 56