grep reverse: how to reverse the meaning of a `grep` search
By Alvin Alexander. Last updated: August 21 2017
Problem
You need to reverse the meaning of a search you're performing with the grep command. For instance, you've been searching for pepperoni pizza orders like this:
grep pepperoni pizza-orders.txt
and now you need to find all orders that don't have pepperoni.
Solution
Just add the -v
switch to your grep
search command, like this: