ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject Re: unix redirection - how do you specify input files?
Date Thu, 21 Dec 2000 19:33:07 GMT
Hello,

Steve Dews wrote:
> 
> Hello,
> 
>     Here's what I'm trying to do:
> 
>            $ sed -e 's/bad/good/' < oldfile > newfile
> 
>     Here's what I've got in Ant:
> 
>            <exec executable="sed" output="./newfile">
>              <arg>-e</arg>
>              <arg>'s/bad/good/'</arg>
>            </exec>
> 
>     Where does the input file belong in the Ant syntax?
>     As an <arg>?  That doesn't seem to work.

The real question is, where does the input file belong in the sed syntax? 
Sed will take input either from stdin or a file.  So just specify the file
after the pattern:
	<exec executable="sed" output="newfile">
	  <arg value="-e"/>
	  <arg value="s/bad/good/"/>
	  <arg value="oldfile"/>
	</exec

However, you may find it easier to use Ant's <replace> task.  For
instance:
	<copy file="oldfile" tofile="newfile"/>
	<replace file="newfile" token="bad" value="good"/>

-Bill Burton

Mime
View raw message