如何通过线使用Ant脚本文件中读取的数据线? [英] How to read data line by line from a file using ant script?

查看:114
本文介绍了如何通过线使用Ant脚本文件中读取的数据线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Perl中,我们使用<&FileDescriptor的GT; 从文件中读取ilne数据线。如何使用ant脚本做同样的。

In perl we use <FileDescriptor> to read data line by ilne from a file. How to do the same using ant script.

推荐答案

您可以做到这一点使用 的loadFile 从任务蚂蚁的contrib (你必须下载并安装蚂蚁的contrib)。

You can do that using the loadfile task in combination with the for task from ant-contrib (you will have to download and install ant-contrib).

<project name="test" default="compile">

  <taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath>
      <pathelement location="path/to/ant-contrib.jar"/>
    </classpath>
  </taskdef>

  <loadfile property="file" srcfile="somefile.txt"/>

  <target name="compile">
    <for param="line" list="${file}" delimiter="${line.separator}">
      <sequential>
        <echo>@{line}</echo>
      </sequential>
    </for>
  </target>

</project>

这篇关于如何通过线使用Ant脚本文件中读取的数据线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆