grep -E 'pat1|pat2' file.txt

Category: Text Processing

grep -E 'pat1|pat2' file.txt

Use extended regex to match multiple patterns

Uses extended regular expressions, letting you match multiple patterns with | (OR). Equivalent to egrep.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.