1 |
Ryan Hill wrote: |
2 |
|
3 |
> Donnie Berkholz wrote: |
4 |
>> On 12:15 Mon 21 Jan , Jean-Noel Rivasseau (elvanor) wrote: |
5 |
>>> # No warnings / Java 5 / all output should be directed to stdout |
6 |
>>> find "${S}" -type f -name '*.xml' -exec \ |
7 |
>>> sed -r -e "s:(-encoding ISO-8859-1):\1 -nowarn:g" -e "s:(\"compilerArg\" |
8 |
>>> value=\"):\1-nowarn :g" \ -e "s:(<property name=\"javacSource\" |
9 |
>>> value=)\".*\":\1\"1.5\":g" \ -e "s:(<property name=\"javacTarget\" |
10 |
>>> value=)\".*\":\1\"1.5\":g" -e "s:output=\".*(txt|log).*\"::g" -i {} \; |
11 |
>> |
12 |
>> I think this will end up calling sed a large number of times, since |
13 |
>> -exec runs per file found instead of once on all files. If you instead |
14 |
>> pipe find output to xargs sed, that might work better. Depending on how |
15 |
>> many files are involved, this could be a significant difference. |
16 |
> |
17 |
> Better yet, use |
18 |
> |
19 |
> find [...] -print0 | xargs -0 sed -r -e [...] -e [...] -i |
20 |
> |
21 |
> This handles files with special characters like spaces in their names. |
22 |
> |
23 |
|
24 |
Or even: find blah -exec sed 'blah "blah"' + |
25 |
It's POSIX[1] and it's in GNU too (after a long delay). The quoting there is |
26 |
a bit yuck. |
27 |
http://wooledge.org/mywiki/UsingFind |
28 |
|
29 |
[1] http://www.opengroup.org/onlinepubs/009695399/utilities/find.html |
30 |
|
31 |
|
32 |
-- |
33 |
gentoo-dev@l.g.o mailing list |