Possible Duplicate:
Regex for “or” in grep
How can I grep for lines with either 'disable' or 'enable' in my file?
I tried $ grep "disable|enable" fail.log
but that shows up nothing.
Possible Duplicate:
Regex for “or” in grep
How can I grep for lines with either 'disable' or 'enable' in my file?
I tried $ grep "disable|enable" fail.log
but that shows up nothing.
You need the -P
switch for Perl Compatible Regular Expressions (PCRE).
Try:
grep -P "disable|enable" fail.log
Without it, grep
uses POSIX Basic Regular Expressions, which have inconsistent escaping and less features.
Try "grep "disable\|enable" fail.log
The backslash turns the | into the "or" metacharacter, otherwise you are grepping for the literal 'disable|enable"