Can anyone give "grep -v" command examples for Linux

I am study grep man page. It said:

-v
Invert the sense of matching, to select non-matching lines.

What does it mean? Can you provide some practical examples of -v option for new Linux user?

The -v option passed to the grep command to remove matching lines. For example, the following would display all lines for matching word “foo”:

grep foo filename

Say you want to show all lines except matching word “foo”, pass the -v option:

grep -v foo filename

Imagine you are looking at a log file (e.g. /val/log/syslog) and don’t want to see the entries that have kernel in them. So you would issue the command

grep -v kernel /var/log/syslog

-v inverts the sense of matching: without -v you would get only the lines that contain kernel

All running processes not related to the root user.

ps -ef | grep -v root

Every line from a file which isn’t a comment

grep -v ^# config.file

Better version. It filter out comments and empty lines i.e. you only see config options:

egrep -v '^#|^$' /etc/httpd/httpd.conf