ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peterrei...@apache.org>
Subject Re: AW: Looping through a file contents
Date Thu, 19 Aug 2004 12:05:56 GMT
an example with ant 1.6.2 and ant-contrib:
<project default="for" xmlns:ac="antlib:net.sf.antcontrib">
  <target name="for">

    <echo file="x.input">
fred
bob
alice
</echo>

    <loadfile property="names" srcfile="x.input"/>
    <ac:for delimiter="${line.separator}" param="name"
            list="${names}">
      <sequential>
        <echo>name is @{name}</echo>
      </sequential>
    </ac:for>
  </target>
</project>

Jan.Materne@rzf.fin-nrw.de wrote:

><for delimiter="${line.separator}"/>
>
>Jan
>
>  
>
>>-----Urspr√ľngliche Nachricht-----
>>Von: Richard Grey [mailto:haamdab@haamdhani.com]
>>Gesendet am: Donnerstag, 19. August 2004 12:39
>>An: user@ant.apache.org
>>Betreff: Looping through a file contents
>>
>>Hello,
>>
>>I've executed an external command using ant's <exec ...> task 
>>and now have the resulting output in a file.
>>
>>How can I then step through this output file and get the 
>>values on each line which I then need to use as parameter 
>>input to a repeated task ?
>>
>>EG - my output file contains the following:
>>--
>>fred
>>bob
>>alice
>>--
>>
>>I therefore need to call a target "xyz" 3 times, with 
>>$(arg)=fred first, then $(arg)=bob etc 
>>
>>Or maybe my output should be dumped into a property ? Even 
>>then, how do I cycle through the output list ?
>>
>>Or am I looking at writing a <taskdef ...> from scratch ?
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>    
>>
>
>
>  
>


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


Mime
View raw message