ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prashant Reddy <>
Subject Re: How to get the count of the number of lines in a file using ANT
Date Wed, 10 Oct 2007 04:42:40 GMT
On Tue, 2007-10-09 at 12:25 -0700, Saladin Sharif wrote:
> But what I am really after is being able to set a flag if the file
> contains one or more lines of text.

oh you are looking to do something like :  
cat log.txt | grep "a string" | wc -l 

<loadfile srcfile="${output}" property="contains.errors">
                   <contains value="${lookingFor}"/>
 <echo file="${basedir}/temp.txt" message="${contains.errors}"/>

So now you have the lines from the ${output} which contain ${lookingFor}
in a temp file temp.txt

After this, you could use the example Matt gave to find out the number
of lines in temp.txt

Hope this helps.


Don't upload, just share :

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message