find, xargs and spaces

Yitzchak Scott-Thoennes
Fri Jul 4 19:32:00 GMT 2008

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.

More information about the Cygwin-talk mailing list