On Wednesday 23 January 2008, Steve Long wrote:
> Ryan Hill wrote:
> > Donnie Berkholz wrote:
> >> On 12:15 Mon 21 Jan , Jean-Noel Rivasseau (elvanor) wrote:
> >>> # No warnings / Java 5 / all output should be directed to stdout
> >>> find "${S}" -type f -name '*.xml' -exec \
> >>> sed -r -e "s:(-encoding ISO-8859-1):\1 -nowarn:g" -e
> >>> "s:(\"compilerArg\" value=\"):\1-nowarn :g" \ -e "s:(<property
> >>> name=\"javacSource\" value=)\".*\":\1\"1.5\":g" \ -e "s:(<property
> >>> name=\"javacTarget\" value=)\".*\":\1\"1.5\":g" -e
> >>> "s:output=\".*(txt|log).*\"::g" -i {} \;
> >>
> >> I think this will end up calling sed a large number of times, since
> >> -exec runs per file found instead of once on all files. If you instead
> >> pipe find output to xargs sed, that might work better. Depending on how
> >> many files are involved, this could be a significant difference.
> >
> > Better yet, use
> >
> > find [...] -print0 | xargs -0 sed -r -e [...] -e [...] -i
> >
> > This handles files with special characters like spaces in their names.
>
> Or even: find blah -exec sed 'blah "blah"' +
> It's POSIX[1] and it's in GNU too (after a long delay). The quoting there
> is a bit yuck.
> http://wooledge.org/mywiki/UsingFindwe specifically discourage `find -exec` in favor of `find -print0 | xargs -0` because it sucks. if your system doesnt support `find -print0` or `xargs -0`, then you need to install GNU findutils. or install a real OS. -mike
signature.asc
Description: This is a digitally signed message part.
