Grep -i

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:

File

Dany Moore

Steve Hawkins

Roger Hipkiss

Loy Hinton

Mandy Moore

Candy Diaz

Fernando Diaz

if you do :

you will get :

1

cat name | grep –i moore

File

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 :

2

cat name | grep moore

Or you can do :

3

grep –i moore name

And still get the same result!

About the Author

Stephane Morin

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Sign up for more great content!

>