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/UsingFind

[1] http://www.opengroup.org/onlinepubs/009695399/utilities/find.html


-- 
gentoo-dev@lists.gentoo.org mailing list

Reply via email to