minus-squareCosmicGiraffe@lemmy.worldtoLinux@lemmy.ml•How grep with -e (regex) `/log/messages` ? [ solved ]linkfedilinkarrow-up1·11 months agoIt’s marked solved, but since OP didn’t post the solution: -e uses basic regular expressions, where you need to escape the meta-characters ((|)) with a backslash. Alternatively, use extended regex with -E $ echo a | grep -E "(a|b)" a $ echo a | grep -e "\(a\|b\)" a $ echo a | grep -e "(a|b)" $ echo a | grep -E "\(a\|b\)" linkfedilink
It’s marked solved, but since OP didn’t post the solution:
-e
uses basic regular expressions, where you need to escape the meta-characters ((|)
) with a backslash. Alternatively, use extended regex with-E
$ echo a | grep -E "(a|b)" a $ echo a | grep -e "\(a\|b\)" a $ echo a | grep -e "(a|b)" $ echo a | grep -E "\(a\|b\)"