Re: xargs: doesn't fail on missing terminator (which may have severe consequences)
Bernhard Voelker <[email protected]>
| Newsgroups | gmane.comp.gnu.findutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 12/15/24 20:47, Bernhard Voelker wrote: > `xargs -0` is similar to many tools allowing Zero-delimited input. > And often the last entry of input does not have to be Zero-terminated. > Here some examples from the GNU coreutils. > > * `sort -z`: > * `uniq -z`: > * `cut -z` > * `tail -z`: P.S. I forgot to mention another class of examples processing files from a list of Zero-separated input: tools with the 'files0-from' option. $ echo hello > hello $ echo world > world * `du` $ printf 'hello\0world' | du --files0-from=- 4 hello 4 world $ printf 'hello\0world\0' | du --files0-from=- 4 hello 4 world * `wc` $ printf 'hello\0world' | wc --files0-from=- 1 1 6 hello 1 1 6 world 2 2 12 total $ printf 'hello\0world\0' | wc --files0-from=- 1 1 6 hello 1 1 6 world 2 2 12 total * `sort` $ printf 'hello\0world' | sort --files0-from=- hello world $ printf 'hello\0world\0' | sort --files0-from=- hello world * and finally GNU `find`: $ printf 'hello\0world' | find -files0-from - hello world $ printf 'hello\0world\0' | find -files0-from - hello world Have a nice day, Berny