in reply to averaging a group of lines with numeric value in a text file

Hi This part of the description of task is unclear "first line of each of the five groups". To what 5 groups do you refer ? Simply after putting the lines in a file called dat.txt get started by pulling the columns using auto split switch -a.
perl -ane '{print $F[5]," ",$F[6],"\n";}' < dat.txt -135.185 178.150 -49.668 -31.158 ... snip -81.417 52.986 -83.126 -56.051
Now do a simple ave
perl -ane '{$t5+=$F[5]; $t6+=$F[6]; $t+=1} END{print $t5/$t," ",$t6/$t,"\n";}' < dat.txt -85.6206666666667 30.2721333333333
Just guessing what is meant by "5 groups". This example uses the contents of Field 3 ( counting from 0 ) to do the grouping
perl -ane '{$t5{$F[3]}+=$F[5]; $t6{$F[3]}+=$F[6]; $t{$F[3]}+=1} END{foreach $i (keys %t5) {print "Group $i ",$t5{$i}/$t{$i}," ",$t6{$i +}/$t{$i},"\n";}} ' < dat.txt Group S -75.969 10.2868 Group G -108.8372 73.3412 Group M -72.0558 7.1884