Write a shell script that will read a file name and pattern from the command line and check whether that pattern exist in file and if exist then count total no. of words in the lines where pattern found


solution:-

echo “enter the file name”

read a

echo “enter the pattern”

read b

grep -n $b $a | wc -w


Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post