I want to grep 2 patterns in a file on Solaris UNIX.
That is grep 'pattern1 OR pattern2' filename.
The following command does NOT work:
grep 'pattern1|pattern2' filename
What is wrong with this command?
NOTE: I am on Solaris
What operating system are you on?
It will work with on systems with GNU grep, but on BSD, Solaris, etc., | is not supported.
|
Try egrep or grep -E, e.g.
egrep
grep -E
egrep 'pattern1|pattern2'
2.1m questions
2.1m answers
60 comments
56.9k users