I have an associative array in awk that gets populated like this:
chr_count[$3]++
When I try to print my chr_counts
, I use this:
for (i in chr_count) {
print i,":",chr_count[i];
}
But not surprisingly, the order of i is not sorted in any way.
Is there an easy way to iterate over the sorted keys of chr_count
?