Created
April 22, 2017 05:21
-
-
Save brett-miller/af50d0672b538099181a12cd983522f2 to your computer and use it in GitHub Desktop.
count of man pages by section
This file contains hidden or 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 | |
# apropos . - whatis database | |
# sed 's/\s*\(.*\)-.*/\1/' - remove content to the right of '-' | |
# sed -e $'s/,/\\\n/g' - split likes on ',' | |
# grep \(.*\) - remove lines without a section | |
# sed 's/[^)]*(\([^)]*\)).*/\1/' - extract the section string | |
# awk '{arr[$1]++}END{for (a in arr) print a, arr[a]}' - get count of each section ($1) | |
# sort -nrk2 - sort by number in reverse order on column 2 | |
# column -t - format in readable columns | |
apropos . | sed 's/\s*\(.*\)-.*/\1/' | sed -e $'s/,/\\\n/g' | grep \(.*\) | sed 's/[^)]*(\([^)]*\)).*/\1/' | awk '{arr[$1]++}END{for (a in arr) print a, arr[a]}' | sort -nrk2 | head -n 25 | column -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment