Last updated 8 months ago
We can invert search in grep by using -v, --invert-match argument, -v only displays lines which does not have pattern in it.
grep
-v, --invert-match
-v
Invert the sense of matching, to select non-matching lines.
$ seq 5 | grep -v 3 1 2 4 5
Here, we are asking grep to hide pattern, which is "3" in this case, and display everything else.
Source: