in reply to du -h, sorted
But then I realized it'd probably be better to use Perl for the sorting, and got this shorter result
Now that sounds like a challenge...
Which gives....
perl -e 'sub h{%h=(K,1,M,4,G,7);pop=~/^(...)(.)/&&$1**$h{$2}}print sort{h($b)<=>h($a)}`du -h`'ok, ok, I promise I'll leave it alone now, there's just the idea of using an anonymous hash to shave off a couple more characters, and the parens can be dropped from h($a), (but not h($b) because of precedences):
perl -e 'sub h{pop=~/(...)(.)/&&$1**{K,1,M,4,G,7}->{$2}}print sort{h($b)<=>h$a}`du -h`'... 90 88 characters.
• another intruder with the mooring in the heart of the Perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: du -h, sorted
by Roy Johnson (Monsignor) on Feb 25, 2009 at 22:58 UTC | |
by grinder (Bishop) on Feb 26, 2009 at 00:17 UTC | |
by hbm (Hermit) on Feb 26, 2009 at 03:00 UTC | |
by bellaire (Hermit) on Feb 26, 2009 at 15:41 UTC | |
by hbm (Hermit) on Feb 26, 2009 at 16:28 UTC | |
by bellaire (Hermit) on Feb 26, 2009 at 19:30 UTC | |
| |
|
Re^2: du -h, sorted
by hbm (Hermit) on Feb 25, 2009 at 23:09 UTC |