> cat sample.log
asd
asd
this
this
this
this
asd
this
this
this
this
this
asd
asd
asd
this
this
this
this
this
> cat checklog
#!/bin/bash
match="this"
cnt=0
while read zf
do
if [ "$zf" = "$match" ]
then
cnt=$((cnt+1))
echo $cnt
else
cnt=0
fi
if [ $cnt -eq 5 ]
then
echo "yep, it met the criteria"
fi
done <sample.log
> checklog
1
2
3
4
1
2
3
4
5
yep, it met the criteria
1
2
3
4
5
yep, it met the criteria
You can (1) remove the echo of the cnt as it just shows the step-thru of data; (2) adjust the match criteria to what you need; etc...