To exclude specific results from a GREP search in linux command line you can call it with the -v parameter
This does the opposite of a normal GREP operation which searches for a specific string (regex expression)
So if you want to search within a file and you get too many results you can do a GREP with a pipe command to exclude certain results like this:
Looking for: world cup Not for: 2009 In the file: test.txt
grep -i "world cup" test.txt | grep -v "2009"
This will then return all results in the file for "world cup" which don't contain 2009
By PHPin24 @ 2009-07-30 10:42:49
|