Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

multiple greps within on exec statement?  RSS feed

Bryan Clauser
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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}/*"/>
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 ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!