matchlines = 0 while ( getline < "temp.data" > 0) { input[matchlines] = $0 system("head -5 < tale.data > tale.hdr") print $0 >> tale.hdr system("tail -29 < tale.data >> tale.hdr") system("sprint tale.hdr") matchlines++ }