You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mike Castle <da...@ix.netcom.com> on 2003/05/14 03:33:53 UTC
Looping over lines in a file
I have an input file I need to process with an ant task.
line1
line2
line3
I need to process each line individually. That is, massage the line, do
some other internal processing on it, and start a java process with that as
an option.
What is the ant way of doing this?
I've started out with <loadfile/> and <foreach/>, but can't figure out how
to either easily turn EOL into a `,' (portably I might add) or tell foreach
that a newline character is the delimiter.
And apparently I haven't found the good search terms to find anything in
the archives.
Suggestions appreciated,
mrc
--
Mike Castle dalgoda@ix.netcom.com www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc
Re: Looping over lines in a file
Posted by Mike Castle <da...@ix.netcom.com>.
In article <20...@web20422.mail.yahoo.com>,
Matt Benson <us...@ant.apache.org> wrote:
>Also, foreach has a "delimiter" attribute. Don't know
>whether this would have worked, but I can't see why it
>shouldn't.
Wasn't sure how to get the delimite to be EOL character, until I did more
playing around. Found ${line.separator}, which does appear to work as the
delmiter.
Thanks for kick in the right direction.
mrc
--
Mike Castle dalgoda@ix.netcom.com www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc
Re: Looping over lines in a file
Posted by Matt Benson <gu...@yahoo.com>.
Also, foreach has a "delimiter" attribute. Don't know
whether this would have worked, but I can't see why it
shouldn't.
-Matt
--- Mike Castle <da...@ix.netcom.com> wrote:
> In article <11...@thune.mrc-home.org>,
> Mike Castle <us...@ant.apache.org> wrote:
> >I've started out with <loadfile/> and <foreach/>,
> but can't figure out how
> >to either easily turn EOL into a `,' (portably I
> might add) or tell foreach
> >that a newline character is the delimiter.
>
> To answer my own questions:
>
> filterchain, prefix, striplinebreaks
>
> Just had to step away from the keyboard for a few
> minutes.
>
> Cheers,
> mrc
>
> --
> Mike Castle dalgoda@ix.netcom.com
> www.netcom.com/~dalgoda/
> We are all of us living in the shadow of
> Manhattan. -- Watchmen
> fatal ("You are in a maze of twisty compiler
> features, all different"); -- gcc
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
Re: Looping over lines in a file
Posted by Mike Castle <da...@ix.netcom.com>.
In article <11...@thune.mrc-home.org>,
Mike Castle <us...@ant.apache.org> wrote:
>I've started out with <loadfile/> and <foreach/>, but can't figure out how
>to either easily turn EOL into a `,' (portably I might add) or tell foreach
>that a newline character is the delimiter.
To answer my own questions:
filterchain, prefix, striplinebreaks
Just had to step away from the keyboard for a few minutes.
Cheers,
mrc
--
Mike Castle dalgoda@ix.netcom.com www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc