Monday, June 6, 2016

Add a new line to a file (ANT)

How do you append lines in ANT?

Two basic things to know:

  • echo task
  • The ant property ${line.separator}


        <echo message="First line. ${line.separator}" file="test_file.txt"/>
        <echo message="Second line ! ${line.separator}" file="test_file.txt" append="true"/>

Notice the "append" attribute on the second echo!

That's all!

Source:
https://ant.apache.org/manual/Tasks/echo.html

No comments:

Post a Comment

Your comment will be visible after approval.