finding consecutive repetitive lines
I have 100+ files of about 150-200 lines each.
Each file has 8 aligned fields and could be separated with /usr/bin/cut.
After reading a line in a loop, I cut FIELD1, FIELD4 and awk FIELD5.
I then use FIELD1 to get the line that was just read and
the following 4 lines with:
/usr/local/bin/grep -A4 "^$FIELD1" "$FILE"
which I then pipe to grep with
|grep "${FIELD4}.*${FIELD5}" |wc -l
I assign the count to a variable
and then test the variable if is equal to 5.
I am getting some accurate results but not perfect results.
To clarify, I want all lines printed if $FIELD4 and $FIELD5
are the same in five successive lines.
Can anyone see the fault in my logic or is there a better way?
Thanks for any .
|