ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ca_iancu <>
Subject how to copy and edit a section of a text file
Date Thu, 09 Oct 2008 13:21:56 GMT

Hello, I'm trying to edit an XML file by searching with regular expressions.
Once found, the text will be copied, changed and appended at the end (or
beginning) of the aforementioned found text.The lines I am looking for have
the following format:

     <device name="some_device">

"some_device" is a variable set dynamically and known at run time
${old.source.device} as seen bellow.

I can find and echo the first line of text with the following syntax, so I
know that the text is there:

<loadfile property=""
  	    <regexp pattern="(.*)device(.*)${old.source.device}"/>

<propertyregex property=""
input="${}" regexp="(.*)(&lt;device.*)" override="true"
<propertyregex property=""
input="${}" regexp="(.*)(\s)" override="true"
<echo> = ${}</echo>

This will return: <device name="some_device"> 
What I am interested however is to be able to find the text beginning at
this line and ending with <\device>, and then saving it into a local
variable as such:
<device name="some_device">

Clearly <linecontainsregexp> will only give one line at the time, but I was
not able to find a filter that could select several lines at once, using
regular expressions. I do not know beforehand how many lines I need to
select. Any help will be appreciated.
View this message in context:
Sent from the Ant - Users mailing list archive at

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

View raw message