You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sann Maung <ya...@yahoo.com> on 2008/02/20 14:30:11 UTC
Can Ant Edit/replace some words in a file
Hi,
I am using Ant to copy some files (eg. program files
like template program).
Then I want to replace some keywords inside the file
with another word.
Can I use Ant to do it?
If possible please guide me.
What I am thinking is to change the words with (sed)
and use Ant to run that (sed). But I am not sure.
rgds,
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: AW: Can Ant Edit/replace some words in a file
Posted by Sann Maung <ya...@yahoo.com>.
Hi,
Danke.
Thanks a lot for your prompt reply. It works.
rgds,
--- Jan.Materne@rzf.fin-nrw.de wrote:
> <copy>
> <filterchain>
>
>
> Jan
>
> > -----Ursprüngliche Nachricht-----
> > Von: Sann Maung [mailto:yangontha55sg@yahoo.com]
> > Gesendet: Mittwoch, 20. Februar 2008 14:30
> > An: Ant Users List
> > Betreff: Can Ant Edit/replace some words in a file
> >
> > Hi,
> >
> > I am using Ant to copy some files (eg. program
> files
> > like template program).
> > Then I want to replace some keywords inside the
> file
> > with another word.
> >
> > Can I use Ant to do it?
> >
> > If possible please guide me.
> >
> > What I am thinking is to change the words with
> (sed)
> > and use Ant to run that (sed). But I am not sure.
> >
> > rgds,
> >
> >
> >
> >
> >
> >
>
______________________________________________________________
> > ______________________
> > Looking for last minute shopping deals?
> > Find them fast with Yahoo! Search.
> >
>
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> user-help@ant.apache.org
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
>
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Can Ant Edit/replace some words in a file
Posted by Dimitris Mouchritsas <di...@eurodyn.com>.
Alec Fernandez wrote:
> Just be careful if you are using filterchain/filterreplace on binary files. Encoding issues can end up transcoding some bytes in binary files. Much has been written on this topic and I would pay close attention.
>
> -alec
>
> -----Original Message-----
> From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
> Sent: Wednesday, February 20, 2008 8:33 AM
> To: user@ant.apache.org
> Subject: AW: Can Ant Edit/replace some words in a file
>
> <copy>
> <filterchain>
>
>
> Jan
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: Sann Maung [mailto:yangontha55sg@yahoo.com]
>> Gesendet: Mittwoch, 20. Februar 2008 14:30
>> An: Ant Users List
>> Betreff: Can Ant Edit/replace some words in a file
>>
>> Hi,
>>
>> I am using Ant to copy some files (eg. program files like template
>> program).
>> Then I want to replace some keywords inside the file with another
>> word.
>>
>> Can I use Ant to do it?
>>
>> If possible please guide me.
>>
>> What I am thinking is to change the words with (sed) and use Ant to
>> run that (sed). But I am not sure.
>>
>> rgds,
>>
>>
>>
>>
>>
>> ______________________________________________________________
>> ______________________
>> Looking for last minute shopping deals?
>> Find them fast with Yahoo! Search.
>> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
>> commands, e-mail: user-help@ant.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
Also try to keep the filtered files few because a good advice is to use
overwrite="true" in the copy task. If you don't use overwrite you could
be changing the filters file and the changes won't be copied over,
because ant sees the dates are ok between the original file and the
destination file (it doesn't check the date on the filter file).
RE: Can Ant Edit/replace some words in a file
Posted by Sann Maung <ya...@yahoo.com>.
Hi,
Thanks for the warning. I will read it. Right now I
can do it on my Windows. But later I wish to try on
Linux.
But I saw a note saying that the file permissions will
not be retained and end up with default UMASK and
suggest to <exec...
I am not sure whether the file permission will affect
my situation. But just in case, if it is important, I
have to use <exec...
Does it mean that can I use filtering with <exec ...
also?
rgds,
--- Alec Fernandez <Al...@sas.com> wrote:
> Ouch, that was vague.... Sorry, not trying to
> fearmonger here.
>
> Here is the reference, look for the important
> encoding note. Seems obvious in retrospect, but it
> snuck up on me despite my prior belief that I was
> semi-aware of transcoding issues :-)
>
>
http://ant.apache.org/manual/CoreTasks/copy.html#encoding
>
>
>
> -----Original Message-----
> From: Alec Fernandez [mailto:Alec.Fernandez@sas.com]
> Sent: Wednesday, February 20, 2008 8:41 AM
> To: Ant Users List
> Subject: RE: Can Ant Edit/replace some words in a
> file
>
> Just be careful if you are using
> filterchain/filterreplace on binary files. Encoding
> issues can end up transcoding some bytes in binary
> files. Much has been written on this topic and I
> would pay close attention.
>
> -alec
>
> -----Original Message-----
> From: Jan.Materne@rzf.fin-nrw.de
> [mailto:Jan.Materne@rzf.fin-nrw.de]
> Sent: Wednesday, February 20, 2008 8:33 AM
> To: user@ant.apache.org
> Subject: AW: Can Ant Edit/replace some words in a
> file
>
> <copy>
> <filterchain>
>
>
> Jan
>
> > -----Ursprüngliche Nachricht-----
> > Von: Sann Maung [mailto:yangontha55sg@yahoo.com]
> > Gesendet: Mittwoch, 20. Februar 2008 14:30
> > An: Ant Users List
> > Betreff: Can Ant Edit/replace some words in a file
> >
> > Hi,
> >
> > I am using Ant to copy some files (eg. program
> files like template
> > program).
> > Then I want to replace some keywords inside the
> file with another
> > word.
> >
> > Can I use Ant to do it?
> >
> > If possible please guide me.
> >
> > What I am thinking is to change the words with
> (sed) and use Ant to
> > run that (sed). But I am not sure.
> >
> > rgds,
> >
> >
> >
> >
> >
> >
>
______________________________________________________________
> > ______________________
> > Looking for last minute shopping deals?
> > Find them fast with Yahoo! Search.
> >
>
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org For additional
> > commands, e-mail: user-help@ant.apache.org
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
>
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Can Ant Edit/replace some words in a file
Posted by Alec Fernandez <Al...@sas.com>.
Ouch, that was vague.... Sorry, not trying to fearmonger here.
Here is the reference, look for the important encoding note. Seems obvious in retrospect, but it snuck up on me despite my prior belief that I was semi-aware of transcoding issues :-)
http://ant.apache.org/manual/CoreTasks/copy.html#encoding
-----Original Message-----
From: Alec Fernandez [mailto:Alec.Fernandez@sas.com]
Sent: Wednesday, February 20, 2008 8:41 AM
To: Ant Users List
Subject: RE: Can Ant Edit/replace some words in a file
Just be careful if you are using filterchain/filterreplace on binary files. Encoding issues can end up transcoding some bytes in binary files. Much has been written on this topic and I would pay close attention.
-alec
-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: Wednesday, February 20, 2008 8:33 AM
To: user@ant.apache.org
Subject: AW: Can Ant Edit/replace some words in a file
<copy>
<filterchain>
Jan
> -----Ursprüngliche Nachricht-----
> Von: Sann Maung [mailto:yangontha55sg@yahoo.com]
> Gesendet: Mittwoch, 20. Februar 2008 14:30
> An: Ant Users List
> Betreff: Can Ant Edit/replace some words in a file
>
> Hi,
>
> I am using Ant to copy some files (eg. program files like template
> program).
> Then I want to replace some keywords inside the file with another
> word.
>
> Can I use Ant to do it?
>
> If possible please guide me.
>
> What I am thinking is to change the words with (sed) and use Ant to
> run that (sed). But I am not sure.
>
> rgds,
>
>
>
>
>
> ______________________________________________________________
> ______________________
> Looking for last minute shopping deals?
> Find them fast with Yahoo! Search.
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Can Ant Edit/replace some words in a file
Posted by Sann Maung <ya...@yahoo.com>.
Hi,
Thanks for your warning. My editing is only for some
simple keywords only.
rgds,
--- Alec Fernandez <Al...@sas.com> wrote:
> Just be careful if you are using
> filterchain/filterreplace on binary files. Encoding
> issues can end up transcoding some bytes in binary
> files. Much has been written on this topic and I
> would pay close attention.
>
> -alec
>
> -----Original Message-----
> From: Jan.Materne@rzf.fin-nrw.de
> [mailto:Jan.Materne@rzf.fin-nrw.de]
> Sent: Wednesday, February 20, 2008 8:33 AM
> To: user@ant.apache.org
> Subject: AW: Can Ant Edit/replace some words in a
> file
>
> <copy>
> <filterchain>
>
>
> Jan
>
> > -----Ursprüngliche Nachricht-----
> > Von: Sann Maung [mailto:yangontha55sg@yahoo.com]
> > Gesendet: Mittwoch, 20. Februar 2008 14:30
> > An: Ant Users List
> > Betreff: Can Ant Edit/replace some words in a file
> >
> > Hi,
> >
> > I am using Ant to copy some files (eg. program
> files like template
> > program).
> > Then I want to replace some keywords inside the
> file with another
> > word.
> >
> > Can I use Ant to do it?
> >
> > If possible please guide me.
> >
> > What I am thinking is to change the words with
> (sed) and use Ant to
> > run that (sed). But I am not sure.
> >
> > rgds,
> >
> >
> >
> >
> >
> >
>
______________________________________________________________
> > ______________________
> > Looking for last minute shopping deals?
> > Find them fast with Yahoo! Search.
> >
>
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org For additional
> > commands, e-mail: user-help@ant.apache.org
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
>
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Can Ant Edit/replace some words in a file
Posted by Alec Fernandez <Al...@sas.com>.
Just be careful if you are using filterchain/filterreplace on binary files. Encoding issues can end up transcoding some bytes in binary files. Much has been written on this topic and I would pay close attention.
-alec
-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: Wednesday, February 20, 2008 8:33 AM
To: user@ant.apache.org
Subject: AW: Can Ant Edit/replace some words in a file
<copy>
<filterchain>
Jan
> -----Ursprüngliche Nachricht-----
> Von: Sann Maung [mailto:yangontha55sg@yahoo.com]
> Gesendet: Mittwoch, 20. Februar 2008 14:30
> An: Ant Users List
> Betreff: Can Ant Edit/replace some words in a file
>
> Hi,
>
> I am using Ant to copy some files (eg. program files like template
> program).
> Then I want to replace some keywords inside the file with another
> word.
>
> Can I use Ant to do it?
>
> If possible please guide me.
>
> What I am thinking is to change the words with (sed) and use Ant to
> run that (sed). But I am not sure.
>
> rgds,
>
>
>
>
>
> ______________________________________________________________
> ______________________
> Looking for last minute shopping deals?
> Find them fast with Yahoo! Search.
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
AW: Can Ant Edit/replace some words in a file
Posted by Ja...@rzf.fin-nrw.de.
<copy>
<filterchain>
Jan
> -----Ursprüngliche Nachricht-----
> Von: Sann Maung [mailto:yangontha55sg@yahoo.com]
> Gesendet: Mittwoch, 20. Februar 2008 14:30
> An: Ant Users List
> Betreff: Can Ant Edit/replace some words in a file
>
> Hi,
>
> I am using Ant to copy some files (eg. program files
> like template program).
> Then I want to replace some keywords inside the file
> with another word.
>
> Can I use Ant to do it?
>
> If possible please guide me.
>
> What I am thinking is to change the words with (sed)
> and use Ant to run that (sed). But I am not sure.
>
> rgds,
>
>
>
>
>
> ______________________________________________________________
> ______________________
> Looking for last minute shopping deals?
> Find them fast with Yahoo! Search.
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org