You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ka...@alltel.com on 2002/04/12 03:44:30 UTC

replace set of strings in files

All,
     I 've a set of files and set of strings. The strings are variables and
they change always. I want to replace the set of strings in a set of files.
I am using the replace task. Is there any way I can specify the list of
files (like comma seperated) ? I can't use the patterns of files in
includes attribute since there are some files with same extensions, I don't
want to replace the string with ?

Basically, I want to use something like the following.

<target name="replacestring" >
     <replace
          dir="."
          includes="xx.sh,yy.sh"
          propertyFile="zz.properties">
          <replacefilter
               token="akhila"
               property="property.key"/>
          <replacefilter
               token="swarn"
               property="property1.key"/>
     </replace>

Or is there any better approach ? Assuming, I 've some 10 files and some 50 strings I want to replace with, in all the 10 files ? I don't want to
specify all the
10 files and 50 strings manually.


Any help is appreciated.

Thx
Kailash



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: replace set of strings in files

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 11 Apr 2002, Kailash Subramanian
<Ka...@alltel.com> wrote:

> Is there any way I can specify the list of files (like comma
> seperated) ?

Yes - you already do su in your example.  The includes attribute.

> Or is there any better approach ?

Use a combination include and exclude patterns to get exactly the list
of files you want.  Use includesfile.

For the replacement tokens, Ant 1.5 will have a way to automatically
turn all properties of a property file into replace tokens, sou you'd
have to write them once into a properties file.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>