Start with a file that has a bunch of numbers like this:
# tail -20 filename
0
0
1
0
3
0
0
54
0
1
1
2
0
0
0
1
21
90
0
0
We want the longest streak of 0s
# awk '{if($1==0)j++;else j=0; print j}' filename | sort -nu | tail -1
7