This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiple greps within on exec statement?

 
Bryan Clauser
Greenhorn
Posts: 29
  • 0
  • 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}/*"/>
</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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic