BEGIN { FS="," RUNS = RUNS ? RUNS : 100 } { arr[$1]++ } END { for (key in arr) { sorted[++I]=key" "100*arr[key]/RUNS } asort(sorted) for (i = 1; i <= I; i++) print sorted[i] }