Grep

  • Html
  • Pdf
  • video

Grep is one of the most usefull tool in linux or unix. With grep you can extract lines that correspond to certain criteria.

The most basic way to use grep is the following :

grep <string> <file name>

Let suppose a file name “name” that contain the name of 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 Moore

you will get :

Dany Moore

Mandy Moore

Or you can do :
2

Grep Moore name

And still get the same result!

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