Say I'm printing out a long series of strings, and instead of only showing lines containing a certain pattern (which one uses "grep" to do), how do I filter out certain patterns?
1 Answer
You still use grep... with the -v
option, which tells grep to print only those lines which do not match the pattern:
grep -v pattern myfile
The long form of the -v
option is --invert-match
(mnemonic: "invert match").
-
8
grep -v pattern files*