Hi,
I am building a script to grep for a string in all the files from a folder and display the results.
I am reading the files one by one by placing the names in other file using while loop
my code is as below
while read inp
do
chk=`grep -c "$str" $pth/$inp`
if [ $chk -ge 1 ]; then
tot=`expr $tot + $chk`
mwl=`expr $mwl + 1`
pg=`expr $pg + $chk`
tput bold
echo " \n $inp --------- STRING(S) FOUND ----------- \n "
tput sgr0
grep -n "$str" $pth/$inp
else
mwol=`expr $mwol + 1`
fi
done<tmp
but the results are scrolled down when i run the script, i want to pause the loop for a key stroke before going to second page based on number of lines printed captured in the variable "pg".
Unix gurus please help me in this regard.
Thanks and regards,
Somasekhar Gajjala.