The grep command supports regular expression pattern. To search multiple words, use following syntax:
grep 'word1\|word2\|word3' /path/to/file
In this example, search warning, error, and critical words in a text log file called /var/log/messages, enter:
grep 'warning\|error\|critical' /var/log/messages
To just match words, add -w with:
grep -w 'warning\|error\|critical' /var/log/messages
egrep command can skip the above syntax and use the following syntax:
egrep -w 'warning|error|critical' /var/log/messages