ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject Re: [help] Search a string in a file
Date Mon, 27 Nov 2006 15:38:33 GMT
I have used <loadfile> with nested filter readers inside, like <tail>
because my expected failure string was supposed to be at the end, and
regexp filtering, to extract just the error status. If the resulting
property was empty, the external process didn't have error, otherwise
my property contained the error count.

Sounds like it was simpler than your situation though, since I
expected only one specific string, and at the end. I don't have this
Ant code with me to share right now, although I have posted something
similar I believe (at least a version that read CVS tag names using
the same Ant techniques.) --DD

On 11/27/06, Dharmesh Vyas <> wrote:
>  Hello all,
> Here is what I am trying to implement to identify if my build process has
> failed.
> For e.g this are the contents of the input file:
> abcd
> xyz
> what
> why
> Rebuild All: 1 failed, 0 skipped
> new world
> Rebuild All: 0 failed, 0 skipped
> techno
> - Read this file to search for string "Rebuild All: 1 failed, 0 skipped" and
> see how many failures were there.
> *The problem I am finding is*
> - I am using regex to perform the pattern matching to check if there were
> any failures. Since the line could appear any no of times in the file, i
> don't know how shall I implement that.
> - Regex takes a string as an input, how can I pass a file to it or there is
> any other task that I shall use.
> Here is how I am using regex for an input string.
> <target name="searchstring>
> <regex property="failure.nos"
>                input="Rebuild All: 0 succeeded, 1 failed, 0 skipped"
>                regexp="Rebuild All: ([0-9]) failed, ([0-9])"
>                select="\1"
>                casesensitive="false" />
>                <echo>${failure.nos}</echo>
> </target>
> Thanks a lot in advance,
> - Dharmesh.
> note: I am sorry if it's a stupid question but I am a novie user/memeber of
> this group.

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

View raw message