[Top][All Lists]

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

du and wc should be able to read arguments from a file

From: Jim Meyering
Subject: du and wc should be able to read arguments from a file
Date: Thu, 18 Sep 2003 09:23:24 +0200

"Dan Heller" <address@hidden> wrote:
> While [using xargs] technically "works" in that comands don't "fail", per se,
> it doesn't solve the real problem at hand; the command is reading all the
> info coming in (du, in this case), and tallying up info "on the fly". If
> it then has to terminate and be restarted again (by xargs), it isn't aware
> of it. To du, it's just running anew. To the user, it's supposed to be
> one task. Some commands that are basically stateless (e.g, mv, cp, etc),
> can survive with xargs exactly as you point out.

> Anyway, the other method is to support the "take the input from a file"
> approach that Dave pointed out:

Thanks for bringing this up.

It would be useful to give du and wc options to make them
read all file name arguments from a file.  Of course, if such
a file were specified as `-', then it would read from stdin.
However, before someone goes off to implement this, here
are a few things to consider.

If the format is simply one file name per line, then what about
files with names containing a newline?

One solution is to require that newlines and backslashes be backslash-escaped.
Another is simply to require that file names be NUL (aka '\0') separated,
like what find's -print0 option would output.
In the interests of keeping things simple, I'm leaning toward the latter.

reply via email to

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