This is the mail archive of the
cygwin-talk
mailing list for the cygwin project.
Re: find, xargs and spaces
- From: "Yitzchak Scott-Thoennes" <sthoenna at efn dot org>
- To: "The Vulgar and Unprofessional Cygwin-Talk List" <cygwin-talk at cygwin dot com>
- Date: Fri, 4 Jul 2008 12:31:27 -0700 (PDT)
- Subject: Re: find, xargs and spaces
- References: <486E6EC5.5010606@bonhard.uklinux.net> <486E7378.ECF576F0@dessent.net>
- Reply-to: The Vulgar and Unprofessional Cygwin-Talk List <cygwin-talk at cygwin dot com>
On Fri, July 4, 2008 12:01 pm, Brian Dessent wrote:
> In the general case, you just have to ensure that whatever's in front of
> xargs in the pipeline outputs null delimited records, and if it doesn't
> insert something in the pipeline that will, such as perl -pe 's,\n,\0,'.
[caveats snippet]
> In this specific case however, just use grep -Z.
>
>> I know this is not Cygwin-specific but if there is a simple answer I
>> would really appreciate the help.
>
> Of course it's not. Don't you think the fileutils list would be a
> better place?
To ask about how to get grep to emit nuls? I don't think so.
(Though if the OP had thought through his question and realized
it boiled down to that, perhaps he would have just consulted
the grep manpage looking for such an option.)
xargs -d '\n' would be preferable to doing a separate newline
translation step. I was going to add the qualifier "unless you
need non-GNU xargs compatibility", but I see that POSIX xargs
doesn't even have -0 (!), so that may be something of a lost cause.