Suppose I have a file input.txt
with few columns and few rows, the first column is the key, and a directory dir
with files which contain some of these
grep requires parameters in order: [what to search] [where to search]. You need to merge keys received from awk and pass them to grep using the \| regexp operator. For example:
arturcz@szczaw:/tmp/s$ cat words.txt
foo
bar
fubar
foobaz
arturcz@szczaw:/tmp/s$ grep 'foo\|baz' words.txt
foo
foobaz
Finally, you will finish with:
grep `commands|to|prepare|a|keywords|list` directory