From: Mikael N. <mi...@na...> - 2002-10-11 14:20:00
|
Played a bit with perl... try this: perl -0077 -ne 's/[^"]*"([^"]*)"[^"]*/$1\n/g; print' file.java -0077 makes perl match the whole file (instead of one line at a time), thus makes it work with multi-line strings. You need to wrap this in some sort of find, of course. And it doesn't support line numbers :-( Oh well, I have to do something useful now :-) /Mikael On Fri, 2002-10-11 at 16:00, Encolpe DEGOUTE wrote: > Le 11 Oct 2002 15:34:25 +0200 > Mikael Nilsson <mi...@na...> a discut=E9: > > Cool! > >=20 > > I also think that properyfiles is the way to go (I assume you mean > > PropertyResourceBundle, right?) >=20 > Yes >=20 > > Regarding finding all string, here's a start (GNU tools assumed): > >=20 > > find . -name "*.java" | xargs grep -n '".*"'| sed -e > > 's/^\(.*java:[0-9]*:\).*"\(.*\)".*$/\1 \2/g' >=20 > Huh! > My regexp was to simple. I will try with this one. > =20 > > It won't catch several strings on one line, or strings spanning > > several lines, unfortunately. Was that the kind of script you wanted? >=20 > I just need to get all strings for the PropertyResourceBundle. >=20 > > Great work! I'll have a look shortly. >=20 > It's not my personnal work, i have just complete Mark works. > Actually i work on a Zope portal. I will begin to ingrate this in two > weeks. >=20 > --=20 > Encolpe DEGOUTE > http://gibbeon.ens-lyon.fr/Portail > Linux, ice hockey and cerebral sports --=20 Plus =E7a change, plus c'est la m=EAme chose. |