You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by peter reilly <pe...@corvil.com> on 2003/04/02 09:06:11 UTC

Re: Inserting text at start of file

You can use replaceregexp.

    <replaceregexp flags="s">
      <regexp pattern="^"/>
      <substitution expression="${line.separator}"/>
      <fileset dir=".">
        <include name="test.txt"/>
      </fileset>
    </replaceregexp>

Peter.
On Wednesday 02 April 2003 08:54, North Alex wrote:
> Hi
>
> I want to insert a line of text (with CR LF at end) to the start of an
> existing file.  There is no token to replace ... just a plain insert at
> start.
>
> I just can't seem to find any simple way of doing it.  I have come up
> with a complicated-well-over-the-top way of copying files and using the
> concat task.  While it's something that works, it's a ugly and I have a
> feeling of reinventing the wheel in rock.  Upgrading ANT and/or
> installing optional tasks is an option (currently using ANT 1.5.1).
>
> Could someone point me in the right direction, please?
>
> <= Alex =>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org