You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Raagu <rk...@gmail.com> on 2009/07/26 13:21:26 UTC

Help On delimiter attribute in for task...

Hello I have an ant script which reads from file "project.properties"

The code snippet is below

<loadfile property="src" srcFile="project.properties" />
<fixcrlf file="project.properties" eol="dos" fixlast="true" />
<for param="letter" list="${src}" delimiter="">
 <sequential>
   <echo>@{letter}</echo>
</sequential>
</for>

I want to read line by line. I am not getting what should I give in the
delititer attribute of for task..
pls tel me  the delimiter attribute value so that for each loop @{letter}
contains one line from from file..
-- 
View this message in context: http://www.nabble.com/Help-On-delimiter-attribute-in-for-task...-tp24666087p24666087.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Help On delimiter attribute in for task...

Posted by "Scot P. Floess" <sf...@nc.rr.com>.
Not that I've tested this...  But what about a \n as the delimiter?  Or 
maybe \r\n ???

On Sun, 26 Jul 2009, Raagu wrote:

>
> Hello I have an ant script which reads from file "project.properties"
>
> The code snippet is below
>
> <loadfile property="src" srcFile="project.properties" />
> <fixcrlf file="project.properties" eol="dos" fixlast="true" />
> <for param="letter" list="${src}" delimiter="">
> <sequential>
>   <echo>@{letter}</echo>
> </sequential>
> </for>
>
> I want to read line by line. I am not getting what should I give in the
> delititer attribute of for task..
> pls tel me  the delimiter attribute value so that for each loop @{letter}
> contains one line from from file..
> -- 
> View this message in context: http://www.nabble.com/Help-On-delimiter-attribute-in-for-task...-tp24666087p24666087.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

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


Re: Help On delimiter attribute in for task...

Posted by "Scot P. Floess" <sf...@nc.rr.com>.
Again, I haven't tested this but based on the online docs for the "for" 
and "foreach" I read this:

"The delimiter characters that separates the values in the "list" 
attribute. Each character in the supplied string can act as a delimiter. 
This follows the semantics of the StringTokenizer class."

However - I just ran a test and its not working...

So I used \\r\\n - it didn't break the lines up correctly.


On Sun, 26 Jul 2009, Raagu wrote:

>
> No.. If we write "\r\n" , then it will take both 'r' and 'n' as delimiters ..
> So it cant distinguish end of line..
> In @{letter} I am getting whole file content..
>
> Btw In project properties file , the output of "dir /b" will be there....
> That is all d directories in that directory will be there..
>
>
>
>
> Raagu wrote:
>>
>> Hello I have an ant script which reads from file "project.properties"
>>
>> The code snippet is below
>>
>> <loadfile property="src" srcFile="project.properties" />
>> <fixcrlf file="project.properties" eol="dos" fixlast="true" />
>> <for param="letter" list="${src}" delimiter="">
>>  <sequential>
>>    <echo>@{letter}</echo>
>> </sequential>
>> </for>
>>
>> I want to read line by line. I am not getting what should I give in the
>> delititer attribute of for task..
>> pls tel me  the delimiter attribute value so that for each loop @{letter}
>> contains one line from from file..
>>
>
> -- 
> View this message in context: http://www.nabble.com/Help-On-delimiter-attribute-in-for-task...-tp24666087p24666975.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

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


Re: Help On delimiter attribute in for task...

Posted by sf...@nc.rr.com.
Hey that's good news!  :)


---- Raagu <rk...@gmail.com> wrote: 
> 
> I got it. We should write ${line.separator} as delimiter attribute value.. It
> works..
> 
> 
> 
> 
> Scot P. Floess-2 wrote:
> > 
> > 
> > And yes - I see what you mean about the two characters...
> > 
> > I was wrong about that one :)
> > 
> > So, curious...  I see you perform loadfile first, then fixcrlf...  Is that 
> > the correct order, or fixcrlf then loadfile?
> > 
> > 
> > 
> > On Sun, 26 Jul 2009, Raagu wrote:
> > 
> >>
> >> No.. If we write "\r\n" , then it will take both 'r' and 'n' as
> >> delimiters ..
> >> So it cant distinguish end of line..
> >> In @{letter} I am getting whole file content..
> >>
> >> Btw In project properties file , the output of "dir /b" will be there....
> >> That is all d directories in that directory will be there..
> >>
> >>
> >>
> >>
> >> Raagu wrote:
> >>>
> >>> Hello I have an ant script which reads from file "project.properties"
> >>>
> >>> The code snippet is below
> >>>
> >>> <loadfile property="src" srcFile="project.properties" />
> >>> <fixcrlf file="project.properties" eol="dos" fixlast="true" />
> >>> <for param="letter" list="${src}" delimiter="">
> >>>  <sequential>
> >>>    <echo>@{letter}</echo>
> >>> </sequential>
> >>> </for>
> >>>
> >>> I want to read line by line. I am not getting what should I give in the
> >>> delititer attribute of for task..
> >>> pls tel me  the delimiter attribute value so that for each loop
> >>> @{letter}
> >>> contains one line from from file..
> >>>
> >>
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/Help-On-delimiter-attribute-in-for-task...-tp24666087p24666975.html
> >> Sent from the Ant - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> >> For additional commands, e-mail: user-help@ant.apache.org
> >>
> >>
> > 
> > Scot P. Floess
> > 27 Lake Royale
> > Louisburg, NC  27549
> > 
> > 252-478-8087 (Home)
> > 919-890-8117 (Work)
> > 
> > Chief Architect JPlate   http://sourceforge.net/projects/jplate
> > Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
> > 
> > Architect Keros          http://sourceforge.net/projects/keros
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Help-On-delimiter-attribute-in-for-task...-tp24666087p24674864.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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


Re: Help On delimiter attribute in for task...

Posted by Raagu <rk...@gmail.com>.
I got it. We should write ${line.separator} as delimiter attribute value.. It
works..




Scot P. Floess-2 wrote:
> 
> 
> And yes - I see what you mean about the two characters...
> 
> I was wrong about that one :)
> 
> So, curious...  I see you perform loadfile first, then fixcrlf...  Is that 
> the correct order, or fixcrlf then loadfile?
> 
> 
> 
> On Sun, 26 Jul 2009, Raagu wrote:
> 
>>
>> No.. If we write "\r\n" , then it will take both 'r' and 'n' as
>> delimiters ..
>> So it cant distinguish end of line..
>> In @{letter} I am getting whole file content..
>>
>> Btw In project properties file , the output of "dir /b" will be there....
>> That is all d directories in that directory will be there..
>>
>>
>>
>>
>> Raagu wrote:
>>>
>>> Hello I have an ant script which reads from file "project.properties"
>>>
>>> The code snippet is below
>>>
>>> <loadfile property="src" srcFile="project.properties" />
>>> <fixcrlf file="project.properties" eol="dos" fixlast="true" />
>>> <for param="letter" list="${src}" delimiter="">
>>>  <sequential>
>>>    <echo>@{letter}</echo>
>>> </sequential>
>>> </for>
>>>
>>> I want to read line by line. I am not getting what should I give in the
>>> delititer attribute of for task..
>>> pls tel me  the delimiter attribute value so that for each loop
>>> @{letter}
>>> contains one line from from file..
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Help-On-delimiter-attribute-in-for-task...-tp24666087p24666975.html
>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
> 
> Scot P. Floess
> 27 Lake Royale
> Louisburg, NC  27549
> 
> 252-478-8087 (Home)
> 919-890-8117 (Work)
> 
> Chief Architect JPlate   http://sourceforge.net/projects/jplate
> Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
> 
> Architect Keros          http://sourceforge.net/projects/keros
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-On-delimiter-attribute-in-for-task...-tp24666087p24674864.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Help On delimiter attribute in for task...

Posted by "Scot P. Floess" <sf...@nc.rr.com>.
And yes - I see what you mean about the two characters...

I was wrong about that one :)

So, curious...  I see you perform loadfile first, then fixcrlf...  Is that 
the correct order, or fixcrlf then loadfile?



On Sun, 26 Jul 2009, Raagu wrote:

>
> No.. If we write "\r\n" , then it will take both 'r' and 'n' as delimiters ..
> So it cant distinguish end of line..
> In @{letter} I am getting whole file content..
>
> Btw In project properties file , the output of "dir /b" will be there....
> That is all d directories in that directory will be there..
>
>
>
>
> Raagu wrote:
>>
>> Hello I have an ant script which reads from file "project.properties"
>>
>> The code snippet is below
>>
>> <loadfile property="src" srcFile="project.properties" />
>> <fixcrlf file="project.properties" eol="dos" fixlast="true" />
>> <for param="letter" list="${src}" delimiter="">
>>  <sequential>
>>    <echo>@{letter}</echo>
>> </sequential>
>> </for>
>>
>> I want to read line by line. I am not getting what should I give in the
>> delititer attribute of for task..
>> pls tel me  the delimiter attribute value so that for each loop @{letter}
>> contains one line from from file..
>>
>
> -- 
> View this message in context: http://www.nabble.com/Help-On-delimiter-attribute-in-for-task...-tp24666087p24666975.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

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


Re: Help On delimiter attribute in for task...

Posted by Raagu <rk...@gmail.com>.
No.. If we write "\r\n" , then it will take both 'r' and 'n' as delimiters ..
So it cant distinguish end of line.. 
In @{letter} I am getting whole file content..

Btw In project properties file , the output of "dir /b" will be there....
That is all d directories in that directory will be there..




Raagu wrote:
> 
> Hello I have an ant script which reads from file "project.properties"
> 
> The code snippet is below
> 
> <loadfile property="src" srcFile="project.properties" />
> <fixcrlf file="project.properties" eol="dos" fixlast="true" />
> <for param="letter" list="${src}" delimiter="">
>  <sequential>
>    <echo>@{letter}</echo>
> </sequential>
> </for>
> 
> I want to read line by line. I am not getting what should I give in the
> delititer attribute of for task..
> pls tel me  the delimiter attribute value so that for each loop @{letter}
> contains one line from from file..
> 

-- 
View this message in context: http://www.nabble.com/Help-On-delimiter-attribute-in-for-task...-tp24666087p24666975.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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