Even i am very new to scripting so i am not very sure of some advance regular expressions. So i am giving the basic shell script
count=0
for i in $(cat location of file)
do
if [ $i == name ]; #name which you want to find from the given file
then
count=`expr $count + 1`
fi
done
echo $count
Homework is not permitted at The UNIX and Linux Forums.
Please read the rules, which you agreed to when you registered, if you have not already done so.
More-than-likely, posting homework has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.