bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20936: suggestion for a 'wart-ish' extension off of 'sort'


From: Erik Auerswald
Subject: bug#20936: suggestion for a 'wart-ish' extension off of 'sort'
Date: Tue, 30 Jun 2015 12:51:02 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Tue, Jun 30, 2015 at 02:35:17AM -0700, Linda Walsh wrote:
> 
> On 6/30/2015 12:46 AM, Erik Auerswald wrote:
> >
> >>>du -sh *|sort -h|tail
> >Why not use 'du -shc * | sort -h | tail -n11'?
> >The total produced by du will sort after all the individual parts.
> Good idea  -- didn't know about '-c', but two things, 1 troubling,
> the other a confusion.  If you have a dir named 'total' it can be
> slightly confusing:

You'll always know that the last total is the total of the above. ;-)

> Ishtar:/tmp/dutest> du -shc * |sort -h|tail
> 1.5M    sperl,v
> 3.6M    total
> 5.0M    total
> Ishtar:/tmp/dutest> du -sh * |hsort -s|tail
> 1.5M    sperl,v
> 3.6M    total
> ----    -----
> 5.1M    TOTAL
> 
> But more a more obvious problem is 'du -shc' seems to be coming up with
> the wrong number -- i.e. 1.5+3.6 = 5.1, not 5.0.

That are probably rounding errors avoided by du, that hsort cannot avoid
anymore.

Thanks,
Erik





reply via email to

[Prev in Thread] Current Thread [Next in Thread]