Pages

Saturday, May 18, 2013

What is grep command: linux

   grep command is used to search a particular pattern in the given input.
for example in snap shot.
first we display content using cat just to check file content

$cat  filename

then give any word which you want to search

$grep "string-name" filename

this displays the entire line in which this string-name appears
if you want to search case insensitve word then just put option -i

$grep -i "string-name" filename

if some word is not found in file then it displays nothing

for  more details about grep you can go to manual page entry by running

$man grep