#!/usr/bin/gawk -f BEGIN { line=1; line2=1; while(getline x < F) { split(x, lines,","); if(line==101) line=1; datas[line,0]=line; if(line2<101) datas[line,1]=lines[2]; else if(line2>=101) datas[line,2]=lines[101]; line++; line2++; } print "#era maxwalkfun keys"; for(i=1;i<=100;i++) { print datas[i,0]" "datas[i,1]" "datas[i,2]; } close(F); }