bug-coreutils
[Top][All Lists]
Advanced

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

Re: du --files-from feature request


From: Eric Blake
Subject: Re: du --files-from feature request
Date: Sun, 30 Nov 2008 18:40:49 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.18) Gecko/20081105 Thunderbird/2.0.0.18 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Aaron Peterson on 11/30/2008 5:16 PM:
> Hi,
> A feature request for du,  a way to sum  from a list of files without
> doing tr \n \0

Thanks for the report.  You didn't mention which version of du you are
using.  du has supported the option --files0-from since coreutils 5.3.0,
in 2005.  The latest stable version is 6.12, and beta 7.0 is also available.

> $ tr $'\n' $'\0' <files.list >files0.list

This doesn't do what you think.  $'\0' is equivalent to the empty string,
not the string containing a NUL byte; you need '\0' (not $'\0') if you
want to manage NUL bytes with tr.  By the way, tr understands '\n', so you
don't have to resort to the less-portable $'\n'.

> $ du -csb --from-files0 files0.list | tail -n1
>     # note the additional tail command that also could be avoided
>     # if there were an option to only display the grand total

Oh, so you are asking for a way to show only the grand total, in addition
to --files0-from.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkzQKEACgkQ84KuGfSFAYA1qQCgq4Kc4YdkINnqEwW5cI528z/p
atEAoM2LQmxkKQRuDJrtq4tkgLDA/hnC
=MIvW
-----END PGP SIGNATURE-----




reply via email to

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