in reply to Re^2: du -h, sorted
in thread du -h, sorted
You're absolutely correct. Allow me to replace it by the following, clocking in at 87.
perl -e'sub h{pop=~/(...)(.)/&&{M,1e3,G,1e6}->{$2}+$1}print sort{h($b) +<=>h$a}`du -h`'
update: No wait! There's something in your idea of bitanding... Just have to get rid of the second spaceship comparator...
perl -e'sub c{pop=~/[GMK]/;(ord$&&7).1e3+$`}print sort{c($b)<=>c$a}`du + -h`'
76 strokes.
• another intruder with the mooring in the heart of the Perl
In Section
Cool Uses for Perl