I'm after a command that will return results based on a pattern match that starts with or ends with a the given pattern.
This is what i have so far.
"cat input.txt | grep "^in|in$"
My main problem is that i cant get the (or) to work but i can get them to work individually.
Thanks for your help in advance.
try this:
grep "^in\|in$" input.txt
by default, grep use BRE
, you have to escape the |
. Or use grep's -E or -P
, in order to avoid escaping those char with special meaning.
P.S, the cat
is no necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With