Last active
August 29, 2015 14:00
-
-
Save dutc/d13b59f40639f6f8a0a6 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
cut -d ';' -f 2- ~/.zsh_history | \ | |
tr '|;' '\n' | \ | |
FS=' ' awk '{ print $1 }' | \ | |
cut -d '/' -f -1 | \ | |
awk '/^[a-zA-Z]/ { cmds[$0] += 1 } END { for (cmd in cmds) print cmd, cmds[cmd] }' | \ | |
awk '{ first = tolower(substr($1,1,1)); count = int($2); if (max[first] < count) { max[first] = count; cmds[first] = $1 } } END { for (f in cmds) print f, cmds[f], max[f] }' | \ | |
sort |
A trivial change, but to make it easy :). Paste this is you don't have ZShell;
cut -d ';' -f 2- ~/.bash_history | \
tr '|;' '\n' | \
FS=' ' awk '{ print $1 }' | \
cut -d '/' -f -1 | \
awk '/^[a-zA-Z]/ { cmds[$0] += 1 } END { for (cmd in cmds) print cmd, cmds[cmd] }' | \
awk '{ first = tolower(substr($1,1,1)); count = int($2); if (max[first] < count) { max[first] = count; cmds[first] = $1 } } END { for (f in cmds) print f, cmds[f], max[f] }' | \
sort
Thank you James!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gives: