This is the mail archive of the
cygwin-talk
mailing list for the cygwin project.
Re: find, xargs and spaces
- From: Brian Dessent <brian at dessent dot net>
- To: The Vulgar and Unprofessional Cygwin-Talk List <cygwin-talk at cygwin dot com>
- Date: Fri, 04 Jul 2008 12:01:12 -0700
- Subject: Re: find, xargs and spaces
- References: <486E6EC5.5010606@bonhard.uklinux.net>
- Reply-to: The Vulgar and Unprofessional Cygwin-Talk List <cygwin-talk at cygwin dot com>
- Reply-to: The Vulgar and Unprofessional Cygwin-Talk List <cygwin-talk at cygwin dot com>
Fergus wrote:
> fails.) (There are probably alternative ways of attacking this specific
> problem that avoid the -print0 .. -0 .. but I would be interested in a
> general solution.)
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,'. Of course, this means that you can't process files that
contain newlines in their names, but if the previous utility in the
pipeline can't natively emit null-delimited output then you've already
lost that battle and it's impossible to recover.
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?
Brian