Grep using list of words from a file.
You need to use the option
-f
:$ grep -f A B
The option
-F
does a fixed string search where as -f
is for specifying a file of patterns. You may want both if the file only contains fixed strings and not regexps.$ grep -Ff A B
You may also want the
-w
option for matching whole words only:$ grep -wFf A B
Read
NOTE: A= file. Searching in file B to see if ANY of the words in file A occur in it.
man grep
for a description of all the possible arguments and what they do.NOTE: A= file. Searching in file B to see if ANY of the words in file A occur in it.
Comments
Post a Comment