ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: Grep?
Date Fri, 03 Mar 2006 08:39:32 GMT

Hi,

give an example, a short snippet, the format
from your output file etc.

which ant task you need an output from ?
what do you want to extract from that output ?
...


example - i used the grep task to check a xmlpropertyfile
for double entries of a property =
...
<xmlproperty file="${ant.working.dir}/props.xml"
semanticattributes="true" keepRoot="false"/>

<!-- check for double property entries -->
<grep in="${vers.module}" regex="(FOOBAR.._.+){2,}" group="0"
property="doubled"/>

<!-- if double entries found  cleanup props.xml -->
<if>
<isset property="doubled" />
	<then>
    <echo>Doubled property entries found &gt;&gt;&gt; Cleanup props.xml
!!</echo>			
	<copy file="${ant.working.dir}/props.xml"
tofile="${ant.working.dir}/propss.xml" overwrite="true">
		<filterchain>
	    <!-- replace first occurence -->
		<replaceregex byline="false"
pattern="&lt;vers.modul\..+" replace=""/>
		<replaceregex byline="false" pattern="&lt;vers.module.+"
replace=""/>
		</filterchain>
	</copy>

<!-- unset of the double properties with Antelope unset task -->
<unset name="vers.module"/>
<unset name="vers.modul.0"/>
				
<!-- create cleaned props.xml -->
<move file="${ant.working.dir}/propss.xml"
tofile="${ant.working.dir}/props.xml" overwrite="true" /> 
<!-- load cleaned props.xml -->
<xmlproperty file="${ant.working.dir}/props.xml"
semanticattributes="true" keepRoot="false"/>
</then>
	<else>
	<echo>NO double property entries found !!</echo>
	</else>
</if>

...

Regards, Gilbert
 

-----Original Message-----
From: angrygreg@gmail.com [mailto:angrygreg@gmail.com] On Behalf Of Greg
Akins
Sent: Thursday, March 02, 2006 4:02 PM
To: Ant Users List
Subject: Re: Grep?

That looks like a good start.. I don't see how to get the output from
an ant task into the grep "in"... But I probably just need to read the
documentation better ;-)

Thanks!

On 3/2/06, Rebhan, Gilbert <Gilbert.Rebhan@huk-coburg.de> wrote:
>
> Hi Greg,
>
> before you roll your own grep task =
>
> there's already a grep task in the Antelope Package.
>
> see =
>
> http://antelope.tigris.org/nonav/docs/manual/bk03ch22.html
>
> I've already used it to parse stuff, works fine.
>
> btw =
>
> It's a bit confusing, that this task isn't part of antcontrib,
> as it was planned to merge the Antelope tasks into antcontrib.
>
> Also some tasks/conditions that are not mentioned in the
> antcontrib manual are contained in antcontrib, if you look
> into the src distribution.
>
> There are several tasks of Antelope f.e. <unset>, that are (yet ?!)
not
> merged into antcontrib.
>
> So i use both > antcontrib 1.0b2 and Antelope 3.2.10
>
> Regards, Gilbert
>
>
> -----Original Message-----
> From: angrygreg@gmail.com [mailto:angrygreg@gmail.com] On Behalf Of
Greg
> Akins
> Sent: Wednesday, March 01, 2006 10:24 PM
> To: user@ant.apache.org
> Subject: Grep?
>
> This seems like it shouldn't be a big deal, but I wasn't able to find
> anything after a couple Google searches.
>
> Running several ant build files through a master file (CruiseControl),
> I'd like to grep the output of a file to see if any errors occurred
> (can't through an Ant failure because the file can contain some
> errors)
>
> I'm using <exec/> to run sql*plus... The results get dumped to ant's
> logging, and I want to search for particular ora- errors?
>
> Any tips that don't involve me writing my own Ant task?
>
> Any help is really appreciated.
>
> Greg Akins
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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