...there has to be a better way to do this.
I have a file that contains lines like the following.
src1 trg1
src2
src3 trg3
I need to parse the file and send the two values in each line to another
program. When there is only one value on the line, I have to send the
value twice. Here's the target I wrote to parse the file. I looks pretty
ugly. Can anyone simplify this?
<target name="test">
<loadfile property="list" srcFile="test_list.txt">
<filterchain>
<tokenfilter delimoutput=","/>
</filterchain>
</loadfile>
<for list="${list}" param="line">
<sequential>
<propertyregex property="source"
input="@{line}"
regexp="^(.+)\s(.+)$"
select="\1"
/>
<propertyregex property="target"
input="@{line}"
regexp="^(.+)\s(.+)$"
select="\2"
/>
<if>
<not>
<isset property="source"/>
</not>
<then>
<property name="source" value="@{line}"/>
<property name="target" value="@{line}"/>
</then>
</if>
<echo>Process Source=${source} Target=${target}</echo>
<var name="source" unset="true"/>
<var name="target" unset="true"/>
</sequential>
</for>
</target>
Thanks,
BEDick
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]