echo "Enter file name:"
read fname
echo "Enter expression to search:"
read exp
echo "Output of grep is :"
grep $exp $fname
echo "Total lines containing $exp in $fname is"
grep $exp $fname | wc –l
output:
[csuser@localhost ~]$ vi gp
[csuser@localhost ~]$ chmod 777 gp
[csuser@localhost ~]$ ./gp
Enter file name:
k
Enter expression to search:
s
Output of grep is :
gdsgsg
sdfgsdgsdg
dfgsdgsg
gsdgsg
Total lines containing s in k is
4
read fname
echo "Enter expression to search:"
read exp
echo "Output of grep is :"
grep $exp $fname
echo "Total lines containing $exp in $fname is"
grep $exp $fname | wc –l
output:
[csuser@localhost ~]$ vi gp
[csuser@localhost ~]$ chmod 777 gp
[csuser@localhost ~]$ ./gp
Enter file name:
k
Enter expression to search:
s
Output of grep is :
gdsgsg
sdfgsdgsdg
dfgsdgsg
gsdgsg
Total lines containing s in k is
4
No comments:
Post a Comment