Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

AW: Replace string in file

Jan Materne

2008-05-15


Author LoginPost Reply
You have to mask that like everywhere in XML.

Jan

> -----Ursprüngliche Nachricht-----
> Von: Guy Catz [mailto:Guy.catz@(protected)]
> Gesendet: Donnerstag, 15. Mai 2008 15:17
> An: Ant Users List
> Betreff: RE: Replace string in file
>
> Thanks for the answer.
>
> I need to replace @token@(protected)>.
> But the ANT engine tells me that I can't use '<' or '>'.
>
> Please advice.
>
> Thanks.
>
> -----Original Message-----
> From: David Weintraub [mailto:qazwart@(protected)]
> Sent: Tuesday, May 13, 2008 8:27 PM
> To: Ant Users List
> Subject: Re: Replace string in file
>
> What type of replacement? You can do a filter on strings like
> @VERSION@,
> @DATE@(protected)
> mappers when you
> copy. For example, I have some configuration files.
> They're called *.properties.template, and I replace the @xxx@(protected)
> with values from a deploy.properties file and remove the *.template
> suffix. The filterset replaces the @xxx@(protected)
> correct values
> while the mapper renames the file by removing the *.template
> suffix:
>
>      <!-- Copy the configuration files that don't contain
> tokens -->
>      <copy todir="${local.jboss.home}/server/${jboss.instance}"
>         verbose="${copy.verbose.flag}">
>         <fileset dir="${jboss.install.home}/jbdev1">
>           <exclude name="**/*.template"/>
>         </fileset>
>      </copy>
>
>      <!-- Copy the configurable files and replace any tokens -->
>      <copy todir="${local.jboss.home}/server/${jboss.instance}"
>         overwrite="true"
>         verbose="${copy.verbose.flag}">
>         <fileset dir="${jboss.install.home}/jbdev1">
>           <include name="**/*.template"/>
>         </fileset>
>         <mapper type="glob"
>           from="*.template" to="*"/>
>         <filterset begintoken="@(protected)="@">
>           <filter token="path_to_server_dir"
>
> value="${local.jboss.home}/server/${jboss.instance}"/>
>           <filtersfile file="${deploy.properties.file}"/>
>         </filterset>
>      </copy>
>
> Is this what you're looking for?
>
> On Mon, May 12, 2008 at 9:18 AM, Guy Catz <Guy.catz@(protected):
> > hey guys,
> >
> > Is it possible to replace a string in an existing file?
> >
> > Thanks,
> >   Guy.
> >
>
>
>
> --
> --
> David Weintraub
> qazwart@(protected)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> commands, e-mail: user-help@(protected)
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.