ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject RE: (newbie) how insert content of one file into middle of anothe r one
Date Fri, 18 Jul 2003 12:59:28 GMT

On Fri, 2003-07-18 at 13:33, Jan.Materne@rzf.fin-nrw.de wrote:

> 
> Maybe <replaceregexp> could do the job.
> http://ant.apache.org/manual/OptionalTasks/replaceregexp.html
> 
> Something like
> 
> <loadfile property="text" srcFile="insertedText"/>
> <replaceregexp
>     file="theFile"
>     match="(.*)(textafterthis)(.*)"
>     replace="\1\2$text\3"
> />
>     
You do not need the .* at the start and end of
the match expression.

Also there may be need to match on a new-line, so
the flags should be set to "s" (I think).

	<property name="location"
                  value="sometext${line.separator}"/>
        <replaceregexp 
            file="test.txt"
            flags="s"
            match="(${location})"
            replace="\1${text}"/>

Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message