Tech I Learnt Today
Thursday, May 11, 2017
How to search for multiple strings in a file using grep
I wanted to search for both ERROR and FAIL in a file using grep.
Came across this:
grep -E "ERROR|FAIL" filename
Or
grep "ERROR\|FAIL" filename
For searching a file for lines not containing a string
grep -v "PASS" filename
Reference:
Grep OR, AND and NOT operators
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment