-
-
Save ryanaslett/5c693e73f9ecf6977fd6 to your computer and use it in GitHub Desktop.
Awk funz
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
# Grabs the third field ($3) in a file, counts how many times that field occurs and outputs it in numeric order. | |
# This is pretty much the equivalent to a sql statement like the following: | |
# SELECT COUNT(*) as ROWS, `Third field` FROM `file` GROUP BY `Third field` ORDER BY `ROWS` ASC | |
awk '{ x[$3]++ } END { for (i in x) print x[i] ":" i }' file |sort -n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment