ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilja Preuss" <pre...@disy.net>
Subject RE: (newbie) how insert content of one file into middle of another one
Date Fri, 18 Jul 2003 12:48:32 GMT
Jan.Materne@rzf.fin-nrw.de wrote:

>> Unfortunately I can't use line number count to find the insertion
>> position in the first file. I have a certain string in this file
>> which is my marker where the insertion should occur.
> 
> 
> 
> 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"
> />

Or alternatively (although less flexible) a combination of loadfile,
filter and copy?

<loadfile property="text" srcFile="insertedText"/>
<filter token="textToReplace" value="${text}"/>
<copy file="theFile" toFile="targetFile" filtering="true"/>

(Notice that the marker needs to be @textToReplace@ in the above
example.)

Regards, Ilja


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


Mime
View raw message