ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <>
Subject Re: wild cards in replace task
Date Sat, 01 Sep 2001 13:50:17 GMT
I'm not sure if the <propertyfile> optional task would work for you or not,
but it seems the closest match to what you describe.    Here is an example:

    <propertyfile comment="Build Information"
        <entry key="version" value="${version}"/>
        <entry key="" pattern="EEEE MMM dd, yyyy" type="date"
        <entry key="build.time" pattern="kk:mm:ss" type="date" value="now"/>
        <!-- and yes, env.COMPUTERNAME is actually cross-platform because I
set its value from env.HOSTNAME if its not already set earlier in my build
file :) -->
        <entry key="" value="${env.COMPUTERNAME}"/>
        <entry key="" value="${}"/>
        <entry key="" value="${}"/>

While I am creating a file from scratch, the <propertyfile> task itself is
capable of editing the file in-place as well.


----- Original Message -----
From: "Anthony Rodriguez" <>
To: <>
Sent: Thursday, August 30, 2001 9:09 PM
Subject: wild cards in replace task

> This question was replied to with a question from another topic.  So I'm
> sending it again:
> Is it possible to use wildcards in the token attribute of the replace
> Say I have a file called text.txt that looks like this:
> text.txt:
> line1="blah blah blah";
> line2="something else";
> Now I want to use a replace task in my build.xml that looks like:
> ....
> <target name="replace"">
> <replace file="text.txt" value="line1=&quot; ${}
> <replacefilter token="line1=&quot; * &quot;;"/>
> </replace>
> </target>
> .....
> I want to use the * because I want to replace the whole line with a new
> line.  I won't always know the exact text in text.txt, so it would be more
> useful just to replace a whole line.  Is there a way to do this (I tried
> * and it didn't work)?  I tried to look for docs on replacefilter but I
> couldn't find any.  Any help would be greatly appreciated.
> -Anthony

View raw message