grep or match code example

Example 1: grep 2 matches or

Just use one of following forms with grep or egrep commands :)
grep "PATTERN1\|PATTERN2" FILE
grep -E "PATTERN1|PATTERN2" FILE
grep -e PATTERN1 -e PATTERN2 FILE
egrep "PATTERN1|PATTERN2" FILE

Example 2: grep and

# EXAMPLE: displays any lines that contain either "include this string" or "this works too" 
egrep "include this string|this works too" *

# SYNTAX:
# egrep "<pattern-1>|<pattern-2>" *

# egrep is combined with the "|" character (pipeline: normally the shift alternative to the "\" on the keyboard)

Example 3: grep or match

$ grep "PATTERN1\|PATTERN2" FILE
$ grep -E "PATTERN1|PATTERN2" FILE
$ grep -e PATTERN1 -e PATTERN2 FILE
$ egrep "PATTERN1|PATTERN2" FILE