Skip to content

Instantly share code, notes, and snippets.

@rohannog
Created July 2, 2012 13:07
Show Gist options
  • Save rohannog/3033181 to your computer and use it in GitHub Desktop.
Save rohannog/3033181 to your computer and use it in GitHub Desktop.
awk group by calculation
NR!=1 {a[$NF]++; total++;}
END {
for (i in a)
printf("Field %2d: %3d (%3.2f\%)\n", i, a[i], a[i]/total*100);
printf ("Total: %d\n", total)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment