Grep multiple strings in a log file and print

grep
shell

#1

Hi,

I would like to grep a 2 words from a file and print in the output file. could you please provide me the code for that…

Thanks
Venkatesh.


#2

Plenty of ways to do it.

egrep 'word1|word2' filename

OR use

grep -e string1 -e string2 filename

If this does not work. Let me know your Unix version/name. See Search Multiple Words / String Pattern Using grep Command on Bash shell