Last active
February 10, 2023 17:17
-
-
Save tekknolagi/e435e35e50a9425f0d3ebf8b7318eae4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Likely originally by Carl Shapiro | |
sort | | |
uniq -c | | |
sort -n | | |
sed 's/^ *//' | | |
awk 'BEGIN { OFS="\t"} { sum += $1; print sum, $1, substr($0, 1 + index($0, " ")) }' | | |
sort -n -r | | |
awk 'BEGIN { IFS=OFS="\t"; print "cum", "pct", "freq" }$1 > max { max = $1 }{ print int($1/max*100), int($2/max*100), $2, $3 }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment