tag 9187 notabug
thanks
On 07/27/2011 08:06 PM, Hugh Esco wrote:
perhaps I just need to learn the right switches to apply to sort on the
other side of a pipe, but I have often wanted to sort the results of du
in descending order and have it get it how to parse the -s(ummary) -h
(uman) readable output.
Rather than bloat du with additional --sort-order parameters, which will
never meet everyone's needs, it's better to make the standard sort able
to generically handle du -h output just like any other sort column. So
much so that in fact, we've already done it, by adding -h to sort.
$ du -sh /var/log/*
You should be pleased with:
du -sh /var/log/* | sort -k1,1h
(You may need to upgrade to coreutils 7.5 or newer)
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org