ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: txtfile with various lines
Date Thu, 09 Dec 2004 13:44:25 GMT

Oops - of course ;-)

-----Original Message-----
From: Dick, Brian E. [mailto:Brian.Dick@FMR.com]
Sent: Thursday, December 09, 2004 2:37 PM
To: Ant Users List
Subject: RE: txtfile with various lines


Just checking, but I'm sure you meant property="servrestart" with the quotes and not property=servrestart
without the quotes.

-----Original Message-----
From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de] 
Sent: Thursday, December 09, 2004 8:31 AM
To: Ant Users List
Subject: RE: txtfile with various lines



Oh boy :-> direct hit.

<loadfile srcfile="K:\test\bla.txt" property="${servrestart}">

Of course property=servrestart

Shame on me ! - Thx a lot.

Too much "Biobrain-Multitasking" here ...

Out of memory ;-)

Gilbert


-----Original Message-----
From: Dick, Brian E. [mailto:Brian.Dick@FMR.com]
Sent: Thursday, December 09, 2004 2:16 PM
To: Ant Users List
Subject: RE: txtfile with various lines


The property attribute is specified wrong. Try property="servrestart".

-----Original Message-----
From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de] 
Sent: Thursday, December 09, 2004 8:08 AM
To: Ant Users List
Subject: RE: txtfile with various lines



Hi, just tried your suggestion, but

<loadfile srcfile="K:\test\bla.txt" property="${servrestart}">
 <filterchain>
            <linecontainsregexp>
                <regexp pattern="^Server"/>
            </linecontainsregexp>
        </filterchain>  
</loadfile>
...
and

<echo message="${servrestart}"/>

gives me always ${servrestart}

regardless whether txtfile contains Line 2 or not. ?!

Gilbert



-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: Thursday, December 09, 2004 1:48 PM
To: user@ant.apache.org
Subject: AW: txtfile with various lines


Basically
    <loadfile property="prop" srcfile="file.txt">
        <filterchain>
            <linecontainsregexp>
                <regexp pattern="^Server"/>
            </linecontainsregexp>
        </filterchain>
    </loadfile>
should do the job.

- load the content of the file into a property
- but ignore all lines which doesnt start with "Server"

And if there is no line, <loadfile> wont set the property.


Jan

> -----Urspr√ľngliche Nachricht-----
> Von: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de]
> Gesendet am: Donnerstag, 9. Dezember 2004 13:26
> An: ant_user (E-Mail)
> Betreff: txtfile with various lines
> 
> 
> Hi,
> 
> Yet another textprocessing question.
> 
> A scriptgenerated txtfile that has 1 or 2 lines, depending on a flag.
> 
> txtfile is either
> 
> Line 1
> 
> or
> 
> Line 1
> Line 2
> 
> where Line 1 and 2 have different contents.
> 
> Line 1 format = string_string_string_string
> Line 2 format = Server has to be restarted
> 
> Problem = i want to set a property, but only if Line 2 appears
> 	    in my txtfile.
> 
> 
> I believe it could be done with LineContains and tailfilter, but
> i didn't get it. There has to be something like =
> 
> tailfilter lines="1"
> if line contains pattern ="^Server"
> then ...
> 
> Don't know how to write that ?!
> 
> Any ideas ?
> 
> Regards, Gilbert
> 
> 
>  
> 
> ---------------------------------------------------------------------
> 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

---------------------------------------------------------------------
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

---------------------------------------------------------------------
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


Mime
View raw message