bash - search multiple keywords recursively in a folder path -


i have text file contains multiple keywords 1 on each line e.g.

  • key1
  • key2
  • key3
  • key4

then have set of sub directories contain many files. need linux grep or sed command equivalent search keywords recursively in sub directories , print file names me.

i can find . | xargs grep "key1" have each keyword. need 1 command key1, key2, key3 etc.

please issue.

this should do:

grep -rlf file . 

-r recursive

-l print names of files containing matches

-f takes pattern file, 1 per line.


Comments