ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: txtfile with various lines
Date Thu, 09 Dec 2004 13:10:50 GMT
Wrong file format? I have tested that with

---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<
----
string_string_string_string
Server has to be restarted
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<
----


and


---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<
----
string_string_string_string
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<
----


Jan


> -----Urspr√ľngliche Nachricht-----
> Von: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de]
> Gesendet am: Donnerstag, 9. Dezember 2004 14:08
> An: Ant Users List
> Betreff: 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
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message