File list - dir list conversion using ant ReplaceRegExp and oro

Nicolas Mailhot <[email protected]> Mon, 12 Jul 2004 12:00:10 +0200
Newsgroups gmane.comp.jakarta.oro.user
Organization Adresse personnelle
Message-ID <[email protected]>
--=-7vlLitKg5zQDFrzbyPfK
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi,

	I'm currently trying to transform a text file containing a list of
absolute filenames into a list of absolute directory names (/a/b/c/d.efg
-> /a/b/c). I'm using the ant ReplaceRegExp task
(http://ant.apache.org/manual/OptionalTasks/replaceregexp.html) with
oro.

	I need the directory names to be unique. Unfortunately since several
files can be in the same directory my first naive attempt resulted in
lots of duplicates :

<project default=3D"test" basedir=3D"." name=3D"regexp">
  <target name=3D"test" description=3D"try to munge the test file">
    <property name=3D"testfile" value=3D"build/core.list"/>
    <property name=3D"outputfile" value=3D"build/coredir.list"/>
    <copy file=3D"${testfile}" tofile=3D"${outputfile}" overwrite=3D"yes"/>
    <!-- Remove lines not starting with / -->
    <replaceregexp file=3D"${outputfile}"
                         match=3D"^[^/](.*)$"
                         replace=3D""
                         byline=3D"true"/>
    <!-- Remove ending file leafs -->
    <replaceregexp file=3D"${outputfile}"
                         match=3D"/[^/]+$"
                         replace=3D""
                         byline=3D"true"/>
  </target>
                                                                           =
                                                  =20
</project>

	So now I need to remove duplicated lines. I suppose it's possible using
ORO and the replaceregexp task (it seems like the kind of thing it can
do) but I can't even figure were to start. Anyone got a bright idea ?

	Regards,

--=20
Nicolas Mailhot

--=-7vlLitKg5zQDFrzbyPfK
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBA8mEqI2bVKDsp8g0RAkDBAKDVJu9MZnToUvuKCf96mhfyTUQtaQCfReuN
d6+kFRRZtbo7b+N0K30S8fc=
=ajop
-----END PGP SIGNATURE-----

--=-7vlLitKg5zQDFrzbyPfK--