Grep multiple strings in a log file and print


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…


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

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki