[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20936: suggestion for a 'wart-ish' extension off of 'sort'
From: |
Linda Walsh |
Subject: |
bug#20936: suggestion for a 'wart-ish' extension off of 'sort' |
Date: |
Tue, 30 Jun 2015 00:28:09 -0700 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.4) Gecko/20150524 FossaMail/25.1.5 |
I admit the ability to show a summary line might not bethe first
thing you'd think a pure-sorting utility might do, but it would be
awfully handy if sort had a 'Numeric sum' option ("-N" -- preferred
'-s', but it's already taken) to go with the -h sorting:
ala:
----
> du -sh *|sort -h|tail
6.0M firmware
6.7M kernel
8.4M tools
26M net
29M sound
30M Documentation
31M include
37M fs
128M arch
330M drivers
--- vs. ---
> du -sh *|hsort -s|tail -12
6.0M firmware
6.7M kernel
8.4M tools
26M net
29M sound
30M Documentation
31M include
37M fs
128M arch
330M drivers
---- -----
649.4M TOTAL
---
I'd donate the code for hsort, but its in perl --
I wrote it several years ago to do what 'sort -h' does, but
also put in the option for a summary line -- handy companion
for 'human numbers', which would otherwise take alot more
typing (I think -- unless there's some hidden switch I don't know
about).