Grep exclude string from search (Linux)

To exclude string from a result set you can use “-v” option:

[[email protected] ~]# echo "hello" && echo "world" | grep "o"
hello
world
[[email protected] ~]# echo "hello" && echo "world" | grep "o" | grep -v "world"
hello

Leave a Reply

Your email address will not be published. Required fields are marked *