ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Martin" <antu...@gmail.com>
Subject Re: [help] Search a string in a file
Date Thu, 30 Nov 2006 11:10:37 GMT
Replying to my own email, using antcount (http://antcount.sourceforge.net/):

<scan>
	<fileset file="a.txt" />
	<filterchain>
		<tokenfilter>
			<countfilter property="number.of.rebuild.all"
			             match="Rebuild All: (\d+) failed, (\d+) skipped">
				<sum property="failed" select="\1"/>
				<sum property="skipped" select="\2"/>
			</countfilter>
		</tokenfilter>
	</filterchain>
</scan>
<echo>
Number of Rebuild All: ${number.of.rebuild.all}
Failed : ${failed}
Skipped : ${skipped}
</echo>

with the following content in a.txt:

abcd
xyz
what
why
Rebuild All: 1 failed, 0 skipped
new world
Rebuild All: 0 failed, 0 skipped
techno
Rebuild All: 1 failed, 0 skipped
Rebuild All: 10 failed, 0 skipped

Gives

Number of Rebuild All: 4
Failed : 12.0
Skipped : 0.0

Cheers,

Patrick

On 11/29/06, Patrick Martin <antuser@gmail.com> wrote:
> Hello,
>
> You may want to have a look at antcount : http://antcount.sourceforge.net/
>
> Cheers,
>
> Patrick
>
> On 11/28/06, Rebhan, Gilbert <Gilbert.Rebhan@huk-coburg.de> wrote:
> >
> > Hi,
> >
> > installing JRuby =
> >
> > you don't have to install JRuby, means no need for setting JRUBY_HOME
> > and stuff,
> > but for using the <script ...> task within ant you need =
> >
> > the bsf.jar (BeanScriptingFramework)
> > _and_
> > the jar of the language you want to use, f.e. =
> >
> > jruby.jar when using ruby
> > groovy-all-1.0-JSR-06.jar when using groovy
> > js.jar when using javascript
> > ...
> >
> > available for ant. Simply put them in %ANT_HOME%/lib and your done.
> >
> > See http://ant.apache.org/manual/install.html#librarydependencies
> > for the links to grab the needed jar's
> >
> > Seems the only thing you're missing is the bsf.jar, or maybe a wrong
> > version,
> > i use bsf-2.3.0, which is rather old (11/2002) but it works.
> >
> > solution with standard ant =
> >
> > none that i know of,  because you have to collect/count all occurences
> > and add them together.
> > Maybe you can go via ant addon tasks, something like antcontrib with
> > regexp,
> > and math task, but a little scripting solution seems much easier.
> >
> > http://ant-contrib.sourceforge.net/
> >
> >
> > Regards, Gilbert
> >
> > ________________________________
> >
> > From: Dharmesh Vyas [mailto:dharmesh.mail@gmail.com]
> > Sent: Tuesday, November 28, 2006 2:06 PM
> > To: Rebhan, Gilbert
> > Subject: Re: [help] Search a string in a file
> >
> >
> > Hello Gilbert,
> >
> > Thanks a tone for time, your reply and suggestions. Really appriciate
> > it. The one solution you had suggested with ant worked for me.
> > I tired with jruby as well. I tried installing it with the help of
> > http://www.headius.com/jrubywiki/index.php/Getting_Started .
> > It got installed successfully. After that when I tried running your
> > suggested solution, I have been getting the error
> > java.lang.ClassNotFoundException: org.jruby.javasupport.bsf.JRubyEngine
> > . I think I need to set the classpath in this case but I am unsure about
> > the path I shall give for the CLASSPATH.
> >
> > One major thing I wanted to ask you is,
> > The solution you had provided using ant works well for me to grab the
> > failure lines. Is there any way where in I can get the failure number or
> > total count of them ( as you had suggested using rails) using ant only ?
> >
> >
> > Thanks a lots in advance,
> > - Dharmesh.
> >
> > ---------------------------------------------------------------------
> > 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