Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Cc: Steve Long <slong@××××××××××××××××××.uk>
Subject: Re: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in dev-util/eclipse-sdk: eclipse-sdk-3.2.1-r2.ebuild ChangeLog eclipse-sdk-3.3.1.1.ebuild
Date: Wed, 23 Jan 2008 22:31:41
Message-Id: 200801231731.36894.vapier@gentoo.org
In Reply to: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in dev-util/eclipse-sdk: eclipse-sdk-3.2.1-r2.ebuild ChangeLog eclipse-sdk-3.3.1.1.ebuild by Steve Long
1 On Wednesday 23 January 2008, Steve Long wrote:
2 > Ryan Hill wrote:
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
8 > >>> "s:(\"compilerArg\" value=\"):\1-nowarn :g" \ -e "s:(<property
9 > >>> name=\"javacSource\" value=)\".*\":\1\"1.5\":g" \ -e "s:(<property
10 > >>> name=\"javacTarget\" value=)\".*\":\1\"1.5\":g" -e
11 > >>> "s:output=\".*(txt|log).*\"::g" -i {} \;
12 > >>
13 > >> I think this will end up calling sed a large number of times, since
14 > >> -exec runs per file found instead of once on all files. If you instead
15 > >> pipe find output to xargs sed, that might work better. Depending on how
16 > >> many files are involved, this could be a significant difference.
17 > >
18 > > Better yet, use
19 > >
20 > > find [...] -print0 | xargs -0 sed -r -e [...] -e [...] -i
21 > >
22 > > This handles files with special characters like spaces in their names.
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
26 > is a bit yuck.
27 > http://wooledge.org/mywiki/UsingFind
28
29 we specifically discourage `find -exec` in favor of `find -print0 | xargs -0`
30 because it sucks. if your system doesnt support `find -print0` or
31 `xargs -0`, then you need to install GNU findutils. or install a real OS.
32 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies