Three Monkeys, Three Typewriters, Two Days

April 14, 2008

Me N for N > 3

To go with this whole awk meme:

% history | awk '{a[$3]++ } END{for(i in a){print a[i] " " i}}' | sort -rn | head
37 latex
27 bibtex
13 cvs
4 ls
3 history
3 backupwork
2 xterm
2 emacs
2 clfiles
1 xdvi

Some notes:

Posted by bzbarsky at April 14, 2008 9:41 PM | TrackBack
Comments

ewww, emacs :p

Posted by: Shawn Wilsher on April 15, 2008 7:48 AM

You get better formatted columns with uniq. :-)

history | awk '{print $3}' | uniq -c | sort -nr | head

Posted by: anlan on April 15, 2008 10:38 AM

Get thee behind me, oh vi-using infidel sdwilsh. ;)

Posted by: Boris on April 15, 2008 10:44 AM

You need anpther sort in there:

history | awk '{print $3}' | sort | uniq -c | sort -nr | head

to make sure all the commands get lumped into their own group.

Posted by: Michael on April 15, 2008 7:22 PM
Post a comment