Grep -v

  • Html
  • Pdf
  • video

Grep –v  stand for inverse.  With grep –v you can extract lines that correspond to the opposite of your search criteria.

Let suppose a file name “name” that contain the name of many people , here is what it contain:

Dany Moore

Steve Hawkins

Roger Hipkiss

Loy Hinton

Mandy Moore

Candy Diaz

Fernando Diaz

If you do :

1

cat name | grep –v moore

you will get :

Steve Hawkins

Roger Hipkiss

Loy Hinton

Candy Diaz

Fernando Diaz

Or you can do :

2

grep –v moore name

And still get the same result!

Please feel free to leave comments, suggestion or to share this post!