GNU bug report logs -
#20990
RFC: [PATCH] accept new option: --files0-from=F
Previous Next
Reported by: Jim Meyering <jim <at> meyering.net>
Date: Mon, 6 Jul 2015 03:34:02 UTC
Severity: wishlist
Tags: patch, wontfix
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Here is a patch to teach grep the --files0-from=F option.
That is the same option that is already supported by wc, du and sort
in the GNU coreutils.
This option allows one to specify NUL-separated file names in the file
argument, F. When I would receive requests to add this option to other
programs from the coreutils, I would refuse, because one can obtain
similar behavior by using xargs like this:
xargs -0 PROGRAM < F
The "use xargs" argument does not work for programs like wc, du and sort.
In those cases, concatenating the output from multiple invocations
(as that xargs usage would do) does not result in the same output as
using --files0-from=F, e.g., because of totals or, for sort, because
the result cannot be the concatenation of separately-sorted outputs.
For most uses of grep, it would be ok to process separate lists of
file names in batches and to concatenate the results, but not with
the --count (-c) option. The count must reflect the total over
all files processed.
Also, more subtly, consider what would happen when the last batch of file
name inputs to xargs happens to contain only one name. The output from
that final invocation of grep (assuming no option like -h or -H) would
omit the "FILENAME:" prefix for any lines matched from that final file.
This patch depends on the perl-based test infrastructure I have just
posted, because the tests are very similar to those for the three tools
from the coreutils.
[0001-accept-new-option-files0-from-F.patch (text/x-patch, attachment)]
This bug report was last modified 2 years and 325 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.