Write a linux shell program to perform check pattern matching using grep

Check pattern matching using grep

Code:

clear 
echo --------------------------------------------- 
echo '\tSearch a word in A particular File' 
echo --------------------------------------------- 
echo Type the string to be searched 
read string 
echo Type the name of the file 
read filename 
if grep $string $filename 
then 
        echo A word in a paricular file. 
else 
        echo A word not in paricular file. 
fi 

Output:

--------------------------------------------- 
Search a word in A particular File 
--------------------------------------------- 
Type the string to be searched 
this 
Type the name of the file 
vino 
A word not in paricular file.

No comments

Powered by Blogger.