Using "OR" type matching pattern with grep command
I have a big text file and i want to grep only those lines who either have "word1" or "word2" or "word3".
How can i do it in a single command?
Currently i am doing this as 3 separate commands:
cat filename | grep word1
Cat filename | grep word2
Cat filename | grep word3
You don't need the cat - try it like this
You can also use "grep -e word1 -e word2 -e word3".
This is more useful in filtering out unwanted lines from a locate command:
grep -v -e /usr/src -e /mnt/ -e pattern1 -e pattern2
Thank you very much syg00 and jschiwal.
Although i find the former more easy.
|All times are GMT -5. The time now is 03:20 AM.|