To search for lines containing string1 or string2 in a file (e.g. my_file.txt):
$ grep -E string1\|string2 my_file.txt
To search for lines not containing string1 or string2 in the file:
$ grep -v -E string1\|string2 my_file.txt
To search for lines containing both string1 and string2 in the file:
$ grep -e string1 -e string2 my_file.txt
To search for lines not containing both string1 or string2 in the file:
$ grep -v -e string1 -e string2 my_file.txt
Saturday, October 13, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment