In it’s default mode of operation, grep filters out lines that do not match the specified filter. However, it’s sometimes desirable to exclude lines that do match the filter, for instance removing lines from a log file that contain your IP address.

For some reason, I always forget how to do this – but it’s easy. Just pass -v to grep, to invert your selection. For instance:

grep -v "127.0.0.1" /path/to/log.log

will remove all lines containing 127.0.0.1.