GNU bug report logs -
#20936
sort: add summary line option
Previous Next
Reported by: Linda Walsh <coreutils <at> tlinx.org>
Date: Tue, 30 Jun 2015 07:29:02 UTC
Severity: wishlist
Tags: wontfix
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20936 in the body.
You can then email your comments to 20936 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#20936
; Package
coreutils
.
(Tue, 30 Jun 2015 07:29:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Linda Walsh <coreutils <at> tlinx.org>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Tue, 30 Jun 2015 07:29:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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).
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20936
; Package
coreutils
.
(Tue, 30 Jun 2015 07:48:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
On Tue, Jun 30, 2015 at 12:28:09AM -0700, Linda Walsh wrote:
> 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
Why not use 'du -shc * | sort -h | tail -n11'?
The total produced by du will sort after all the individual parts.
Thanks,
Erik
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20936
; Package
coreutils
.
(Tue, 30 Jun 2015 09:36:02 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
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:
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.
In my original example, it's off by more:
Ishtar:linux/linux-4.1.0> du -sch *|sort -h|tail
6.7M kernel
8.4M tools
26M net
29M sound
30M Documentation
31M include
37M fs
128M arch
330M drivers
645M total
Ishtar:linux/linux-4.1.0> du -sh *|hsort -s|tail
8.4M tools
26M net
29M sound
30M Documentation
31M include
37M fs
128M arch
330M drivers
---- -----
649.4M TOTAL
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20936
; Package
coreutils
.
(Tue, 30 Jun 2015 10:52:01 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20936
; Package
coreutils
.
(Tue, 30 Jun 2015 15:59:01 GMT)
Full text and
rfc822 format available.
Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):
On 6/30/2015 3:51 AM, Erik Auerswald wrote:
>
>> 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.
---
1) I think you're right, but 2) it still looks odd to see 1.5+3.6=5.0
and not 5.1
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20936
; Package
coreutils
.
(Tue, 30 Jun 2015 17:06:03 GMT)
Full text and
rfc822 format available.
Message #20 received at 20936 <at> debbugs.gnu.org (full text, mbox):
Hello,
On 06/30/2015 03:28 AM, Linda Walsh wrote:
> 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:
>
<...>
> > du -sh *|sort -h|tail
A slightly different approach would be to defer the "human" size to later,
and enable to do any calculation you want manually, then convert to human sizes with "numfmt":
du -s * \
| sort -n \
| awk '{ sum+=$1 ; print } END { print sum, "Total" }' \
| numfmt --to=iec
One more thing: instead of 'du -s *', perhaps 'du -d1' would work better (depending on your needs), as it will print sizes used only by directories.
- assaf
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20936
; Package
coreutils
.
(Tue, 30 Jun 2015 19:11:02 GMT)
Full text and
rfc822 format available.
Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):
2015-06-30 12:51:02 +0200, Erik Auerswald:
[...]
> > 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.
[...]
Also, du -c gives you the cumulative usage (think of hard
links that need to be counted once), not the sum of the above.
--
Stephane
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20936
; Package
coreutils
.
(Tue, 30 Jun 2015 19:21:02 GMT)
Full text and
rfc822 format available.
Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):
2015-06-30 13:05:38 -0400, Assaf Gordon:
[...]
> One more thing: instead of 'du -s *', perhaps 'du -d1' would
> work better (depending on your needs), as it will print sizes
> used only by directories.
Yes, and it will also include hidden files/dirs and won't have
problems with filenames starting with -. Add -a if you also want
non-directory files.
--
Stephane
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20936
; Package
coreutils
.
(Tue, 23 Oct 2018 02:34:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 20936 <at> debbugs.gnu.org (full text, mbox):
severity 20936 wishlist
tags 20936 wontfix
retitle 20936 sort: add summary line option
close 20936
stop
(triaging old bugs)
On 30/06/15 01:10 PM, Stephane Chazelas wrote:
> 2015-06-30 13:05:38 -0400, Assaf Gordon:
> [...]
>> One more thing: instead of 'du -s *', perhaps 'du -d1' would
>> work better (depending on your needs), as it will print sizes
>> used only by directories.
>
> Yes, and it will also include hidden files/dirs and won't have
> problems with filenames starting with -. Add -a if you also want
> non-directory files.
>
With no further comments in 3 years, I'm closing this bug.
regards,
- assaf
Severity set to 'wishlist' from 'normal'
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 23 Oct 2018 02:34:03 GMT)
Full text and
rfc822 format available.
Added tag(s) wontfix.
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 23 Oct 2018 02:34:03 GMT)
Full text and
rfc822 format available.
Changed bug title to 'sort: add summary line option' from 'suggestion for a 'wart-ish' extension off of 'sort''
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 23 Oct 2018 02:34:03 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
20936 <at> debbugs.gnu.org and Linda Walsh <coreutils <at> tlinx.org>
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 23 Oct 2018 02:34:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 20 Nov 2018 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 213 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.