I have a file that is dynamic in length, and I need to parse the second field out of it, then split that into groupings of 20 entries and echo a variable above each grouping of 20. The script is written in bash. I am sure there is a way to use awk, but my awk book is at home, and I am out of town.
count=1
awk '{print $2}' yourFile |
while read LINE
do
if [ $count -eq 1 ]; then echo $someVar; fi
echo $LINE
if [ $count -eq 20 ]; then count=0; fi
count=`expr $count + 1`
done
This grabs the second field of each line and feeds it directly to the while loop, which prints the variable, 20 lines, the variable, 20 more lines, etc, until everything is read.