• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

multiple greps within on exec statement?

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Get off me! Here, read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic