I need to find two words or string in file. So i try
grep -w word1 file | grep -w word2
grep -w string1 file | grep -w string2
It is not working at all. Why don’t grep support searching two words? Is it even possible?
I need to find two words or string in file. So i try
grep -w word1 file | grep -w word2
grep -w string1 file | grep -w string2
It is not working at all. Why don’t grep support searching two words? Is it even possible?
Try:
grep -w 'word1\|word2' file
See my tutorial page for more info:
https://www.cyberciti.biz/faq/searching-multiple-words-string-using-grep/
hello.
you must type
grep -w 'string1\|string2' filename