1# merge index entries into one line per label 2$1 == prev { 3 printf ", %s", $2; 4 next; 5} 6{ 7 if (NR != 1) 8 printf "\n"; 9 printf "%s \t%s", $1, $2; 10 prev = $1; 11} 12END { 13 printf "\n" 14} 15