Hey, wonder if you guys can help me? I'm trying to use ant to copy a portion of one text file in to another text file. I have specific markers that I can use for this.
The source file has the format shown below, // ----- src file start a few lines of text <service name="ServiceName" ... > One or more lines of stuff </service> more stuff I don't want. // ----- src file end In the destination file I want to replace the existing entry between (and including the service tags) with the one extracted from the above file. // ----- dest file start a few lines of some text <service name="ServiceName" .... > the old copy of the service definition that i want to replace </service> more stuff to be ignored // ----- dest file end Now I believe I can achieve the above using something like the following, <loadfile property="wsdd" srcfile="srcFile.txt"> <filterchain> <tokenfilter> <filetokenizer/> <replaceregex pattern="^.*<service name="ServerName"" replace="" flags="s"/> <replaceregex pattern="service>.*$" replace="" flags="s"/> </tokenfilter> </filterchain> </loadfile> <replace file="destFile.txt" token="@SPECIAL_TOKEN@" value="${wsdd}"/> 1. The regex isn't up to scratch. What I really want to do it extract the bit between the tags and ignore the rest. Any suggestions? 2. The replace file will only work if the token is in the file (obviously). The problem here is that I can run the task over and over again replacing the old value in destFile. What I really want to do on each replace is replace the portion between <service name="ServiceName"..> and the next </service> tag. Many thanks for your time, gaz. ___________________________________________________________ The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]