ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject <loadfile>,<filterchain>,<tokenfilter> with regular exp
Date Tue, 05 Apr 2005 06:39:56 GMT

to whom it may concern ...

Some time ago, i asked for a solution to extract a specific part
out of a txtfile using <loadfile>,<filterchain>,<tokenfilter> with
regular expressions.

In the meantime after putting aside a while, i've found a solution.
So if anybody has a similar problem, it may be helpful.

Situation = a given txtfile has to be scanned, format is :

... always 29 lines above i don't care for
* here at line 30 the part i want to extract starts
* there may follow one or n more lines
* ...
* ...
..Project - Repository under: <- the closing
CVS			      <- pattern
... more (blank) lines

The first line of the closing pattern contains some leading blanks.

I want to extract the part with the leading ' * '

my snippet =

<loadfile srcFile="path:/to my/foo.txt" property="myproperty">
<!-- load the whole file and throw away the first 29 lines -->
            <headfilter lines="-1" skip="29"/>
<!-- delete the lines with the closing pattern, replace with " " -->
                <replaceregex pattern="^.*(.+Project - .+der:|^CVS).*$"
<!-- take out the remaining blank lines -->
            <deletecharacters chars="\t"/>

The replaceregex ... replace="" works with and without flags="m".
I thought i had to use that, cause i go over some lines but it works


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message