how can I capture all lines from a text file that begin with the character “X” or contain the word “foo”?
This works:
cat text | grep '^@' # begins with @
but I tried:
cat text | grep '^@|[foo]'
and variations but cannot find the right syntax anywhere. how can this be done?
thanks.
If your grep implementation isn’t POSIX compliant, you can use egrep instead of grep: