You're viewing a comment by Kent Fredric and its responses.

Kent Fredric Permalink
June 03, 2010, 00:35

You can do that awk command just as easily with perl, but its a bit longer.

history | 
  perl -nle '$_=~s/\s*\d*\s*//; 
             $cache{$_}++ 
            }{ 
              @foo = sort { -( $a->[0] <=> $b->[0] ) } 
                      map { [ $cache{$_}, $_ ] } 
                       keys %cache ; 
              print "@{$foo[$_]}" for 0..10 
'

I love that perl-butterfly operator :)

( line feeds added for clarity. )

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the first letter of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.