Grep -i

  • Html
  • Pdf
  • video

Grep –i Stand for case insensitive. With grep –i you can extract lines that correspond to your search criteria no matter the cases.

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 –i moore

you will get :

Dany Moore

Mandy Moore

Like you can see , your searching for moore with the 'm' in lowercase and you still get the line that contain moore with the 'M' in uppercase or else like you known linux is case sensitive and if you omit the -i option it will return no line like the following :

cat name | grep moore

Or you can do :

2

grep –i moore name

And still get the same result!

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

Click here to add a comment

Leave a comment: