aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes multiple greps within on exec statement? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "multiple greps within on exec statement?" Watch "multiple greps within on exec statement?" New topic
Author

multiple greps within on exec statement?

Bryan Clauser
Greenhorn

Joined: Mar 05, 2002
Posts: 29
I am trying to use grep, awk, ... commands within a ant target without much luck. Here is an example of the command I am trying to execute:
grep -i -r error *
This can be broken down into:
<exec executable="${cygwin}\grep">
<arg value="-i"/>
<arg value="-r"/>
<arg value="error"/>
<arg value="${somedir}/*"/>
</exec>
what I am wanting to do is take the results from one grep and send it to another:
grep -i -r error * | grep -v none
Since you cannot have nested <exec> statements, how could you go about implementing this command? I am eventually working my way up to the following command inside an exec:
grep -c -r -h SomeSearch * | awk ' $1>0 { total +=$1 } END { print total }'
The command is good, but getting it to run from inside an ant script is what I can't figure out.
[ January 20, 2004: Message edited by: Bryan Clauser ]

Bryan<p>SCJP, SCJD, SCWCD</p>
 
 
subject: multiple greps within on exec statement?