On 2006-02-03 Brian White <[EMAIL PROTECTED]> wrote: > Package: findutils > Version: 4.1.20-6 > Severity: wishlist
> It would be useful to have an option in xargs that specifies that the > filename separator is a linefeed (or an option to specify any arbitrary > separotor). > This would be really useful with find where filenames have spaces. I > know that you can use -print0 and -0 like this > find / -name "*find*" -print0 | xargs -0 command > but that doesn't allow for more extended pipelines. There is no way to > process the find output with other commands. This won't work: > find / -name "*find*" -print0 | grep -v baddir | xargs -0 command [...] /me points to grep's -z and -Z option There is also the possibility to plug in tr in between: find ... -print | do someting | do something ... \ tr '\n' '\0' \ xargs -0 command I'd strongly advise against this hack (actually any use of xargs without -n) on untrusted directories as it will break dangerously with filenames containing newline. [EMAIL PROTECTED]:/tmp/test$ mkdir 'foo > ' [EMAIL PROTECTED]:/tmp/test$ mkdir 'foo '/etc [EMAIL PROTECTED]:/tmp/test$ echo blah > 'foo /etc'/passwd [EMAIL PROTECTED]:/tmp/test$ find . ./foo? ./foo?/etc ./foo?/etc/passwd [EMAIL PROTECTED]:/tmp/test$ find -type f -print | xargs ls -l ls: ./foo: No such file or directory -rw-r--r-- 1 root root 1201 Jan 22 11:16 /etc/passwd cu andreas -- The 'Galactic Cleaning' policy undertaken by Emperor Zhark is a personal vision of the emperor's, and its inclusion in this work does not constitute tacit approval by the author or the publisher for any such projects, howsoever undertaken. (c) Jasper Ffforde -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]