Nguyễn Việt Thắng
New member
How do I combine two grep commands?
Answer
Two possibilities:
Answer
Two possibilities:
- Group them: { grep ‘substring1’ file1.txt grep ‘substring2’ file2.txt } > outfile.txt. …
- Use the appending redirection operator >> for the second redirection: grep ‘substring1’ file1.txt > outfile.txt grep ‘substring2’ file2.txt >> outfile.txt.