fw's Journal http://use.perl.org/~fw/journal/ fw's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-02-08T17:47:58+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 fw's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~fw/journal/ more commands! http://use.perl.org/~fw/journal/40298?from=rss <p>In reply to <a href="http://blog.afoolishmanifesto.com/archives/1318">fREW Schmidt</a>'s and <a href="http://blogs.perl.org/users/ovid/2010/04/meme.html">Ovid</a>'s top 10 history commands, here is my list:</p><blockquote><div><p> <tt>fw@hal2 ~<nobr> <wbr></nobr>:) % history -n 1 | awk {'print $1'} | sort | uniq -c | sort -k1 -rn | head<br>&nbsp; 13299 cd<br>&nbsp; &nbsp;7846 ls<br>&nbsp; &nbsp;7126 perl<br>&nbsp; &nbsp;5755 vim<br>&nbsp; &nbsp;3117 git<br>&nbsp; &nbsp;2893 sudo<br>&nbsp; &nbsp;1319 exit<br>&nbsp; &nbsp;1134 lt<br>&nbsp; &nbsp; 977 rm<br>&nbsp; &nbsp; 817 perldoc</tt></p></div> </blockquote><p> <code>alias lt='ls -ltr'</code> </p><p>(this is from my eternal zsh history which started on Nov 4th, 2008)</p><p>-- Frank</p> fw 2010-04-06T07:26:41+00:00 journal First Perl6 program http://use.perl.org/~fw/journal/38055?from=rss This one reads STDIN, counts words (here words are things between whitespace), and prints them sorted in descending order by occurrence.<blockquote><div><p> <tt>my %words;<br> <br>$*IN.lines.split(/\s+/).map: { %words{$_}++ };<br> <br>for %words.pairs.sort: { $^b.value &lt;=&gt; $^a.value } -&gt; $pair {<br>&nbsp; &nbsp; say $pair<br>}</tt></p></div> </blockquote><p> <small>see also: <a href="http://perlmonks.org/?node_id=729238">this node at perlmonks</a> </small></p> fw 2008-12-09T21:43:07+00:00 journal