Maybe I'm missing something very simple, but I don't seem to be able to use grep from the command line (in bash) where the search argument contains a vertical bar |
.
For example,
grep a|b
results in the error bash: b: command not found. Of course.
Escaping the pipe
grep a\|b
gets rid of the error, but results in grep itself interpreting the pipe as a literal search character (i.e. it searches for the text a|b
in the input rather than "a or b").
grep "a|b"
has the same result: it also searches for the literal text a|b
.
So, what now? I also tried '
and ` for delimiters, and now I'm out of things to think of.
Open to suggestions!
(In case it matters, this is with Debian 12, KDE and konsole for a terminal.)