• 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

How to execute a grep command from Ant?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hello,

Can some one please help on how to execute a linux command like grep from ANT ?

Here is the command i want to run (grep = xyz.txt > abc.properties)

Can we use <exec task from ANT ? If so how to use it ?

Can i use something like this ?

<exec dir="${input}" command="grep = xyz.txt > abc.properties"/>

Please suggest!!

Thank you!!
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you want to use the <exec> task. Check out the docs for that task, it will give you some examples on how to invoke apps:
http://ant.apache.org/manual/Tasks/exec.html
Look specifically at the "output" property, that is how you would specify the "abc.properties" in your example.
Look at the <args> nested element, that is how you pass command line option to grep.
Finally, the "executable" property should be set to "grep", not to the full command line.

If you still have problems, feel free to post again, we'll be glad to help.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic