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 12:48:25 GMT
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
> 

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