ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dharmesh Vyas" <dharmesh.m...@gmail.com>
Subject [help] Search a string in a file
Date Mon, 27 Nov 2006 15:30:47 GMT
 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.

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