It may be helpful to show a few original lines of data,
your rules for inclusion,
and especially how many fields (and where placed) to expect
and desired output
I know, but if you're using awk, things like sed are usually redundant... And if your file really does have 300 columns, the lines might be too wide for sed to accept on some systems. Anyway:
sed "s/'$//" data | awk '{for(N=6; N<=NF; N++) T[N]+=$N ; MAX=NF } END { for(N=6; N<=MAX; N++) print T[N]/NR }' data
1
0
1
0
0
1
1
1
1
0
0
1
1
0
$
Looks funny, but correct since the lines are all the same