[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug#563118: du cannot sort its output without help from other programs
From: |
Juhapekka Tolvanen |
Subject: |
Bug#563118: du cannot sort its output without help from other programs |
Date: |
Thu, 31 Dec 2009 01:35:59 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Package: coreutils
Version: 8.1-1
Severity: wishlist
I wanted to do this: Give sizes of each files and directories located
in $PWD in human-readable-format AND sort output according to sizes of
those files and directories. Formerly I did it like this:
du -s * | sort -n | awk '{print $2}' | xargs du -sh
But that breaks, if file name has space or linefeed. After reading
manuals I created this:
du -s * | sort -n | cut -f 2- | tr '\n' '\0' | xargs -r0 -I "{}" du -sh "{}"
But it still breaks, if file name has linefeed.
I wanted to be sure that I get what what I want, whatever characters
file names have. Therefore I created this script:
http://iki.fi/juhtolv/hacks/sh/sortdu.sh.bz2
Some other guy created this kind of script:
http://inz.fi/sortdu2.txt
But it would be much easier, if du had some sorting functionalities.
-- System Information:
Debian Release: squeeze/sid
APT prefers stable
APT policy: (990, 'stable'), (500, 'testing-proposed-updates'), (500,
'proposed-updates'), (101, 'testing'), (99, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-trunk-686 (SMP w/1 CPU core)
Locale: LANG=fi_FI.utf8, LC_CTYPE=fi_FI.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages coreutils depends on:
ii libacl1 2.2.49-1 Access control list shared library
ii libattr1 1:2.4.44-1 Extended attribute shared library
ii libc6 2.10.2-2 GNU C Library: Shared libraries
ii libselinux1 2.0.89-4 SELinux runtime shared libraries
coreutils recommends no packages.
coreutils suggests no packages.
-- no debconf information
--
Juhapekka "naula" Tolvanen * http colon slash slash iki dot fi slash juhtolv
"Quidquid Latine dictum sit altum videtur."
- Bug#563118: du cannot sort its output without help from other programs,
Juhapekka Tolvanen <=