[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-oro-user
Subject: File list - dir list conversion using ant ReplaceRegExp and oro
From: Nicolas Mailhot <Nicolas.Mailhot () laPoste ! net>
Date: 2004-07-12 10:00:10
Message-ID: 1089626411.5269.12.camel () ulysse ! olympe ! o2t
[Download RAW message or body]
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="test" basedir="." name="regexp">
<target name="test" description="try to munge the test file">
<property name="testfile" value="build/core.list"/>
<property name="outputfile" value="build/coredir.list"/>
<copy file="${testfile}" tofile="${outputfile}" overwrite="yes"/>
<!-- Remove lines not starting with / -->
<replaceregexp file="${outputfile}"
match="^[^/](.*)$"
replace=""
byline="true"/>
<!-- Remove ending file leafs -->
<replaceregexp file="${outputfile}"
match="/[^/]+$"
replace=""
byline="true"/>
</target>
\
</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,
--
Nicolas Mailhot
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic