ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nagarajan Murugesan <NMURUGE...@Selectica.com>
Subject RE: character replacement from a file content
Date Wed, 27 Aug 2003 11:54:55 GMT
Hai,

I have tried with regex also, it doen't work

Here is the sample script:

<replaceregexp file="D:/CD/Results.xml" match="/gt;&lt;"
replace="/gt; &lt;"/>
<replaceregexp file="D:/CD/Results.xml" match="gt;&lt;" 	replace="gt;
&lt;"/>

ie I want to add a space between /gt;&lt; and gt;&lt; in the file containing

following text.

&lt;?xml version="1.0" encoding="UTF-8"?&gt;&#13;
&lt;Response&gt;&lt;Header&gt;&lt;sessionId&gt;8875285a07f7ga4604268hhaa92c2
8699&lt;/sessionId&gt;&lt;workflowresponse&gt;&lt;uname&gt;Mr. Admin
User&lt;/uname&gt;&lt;userid&gt;fsadmin&lt;/userid&gt;&lt;partyroleid&gt;PR1
0001&lt;/partyroleid&gt;&lt;firstname&gt;Admin&lt;/firstname&gt;&lt;middlena
me
/&gt;&lt;lastname&gt;User&lt;/lastname&gt;&lt;role&gt;ADMINISTRATOR&lt;/role
&gt;&lt;/workflowresponse&gt;&lt;action&gt;create&lt;/action&gt;&lt;type&gt;
sptest&lt;/type&gt;&lt;sessionId&gt;8875285a07f7ga4604268hhaa92c28699&lt;/se
ssionId&gt;&lt;svrType&gt;foundation
services&lt;/svrType&gt;&lt;id&gt;SP1111554&lt;/id&gt;&lt;/Header&gt;&lt;spt
est id="SP1111554"
source="SPDB"&gt;&lt;objectid&gt;SP1111554&lt;/objectid&gt;&lt;IntegerPara
/&gt;&lt;FloatPara /&gt;&lt;StringPara /&gt;&lt;DatePara
/&gt;&lt;ProcedureResponse /&gt;&lt;/sptest&gt;&lt;/Response&gt;&#13;

can you help me to solve this??

Thanks,
Nagarajan M.

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: Wednesday, August 27, 2003 5:18 PM
To: user@ant.apache.org
Subject: RE: character replacement from a file content


Have you tried the <replace> task?
Or the <regex> filter?


Jan

> -----Original Message-----
> From: Nagarajan Murugesan [mailto:NMURUGESAN@Selectica.com]
> Sent: Wednesday, August 27, 2003 1:28 PM
> To: Ant Users List
> Subject: character replacement from a file content
> 
> 
> 
> Hai All,
> 
> Is there any way to replace particular character or substring 
> of a given file content with some value.
> 
> For example a file read.txt contains "greatoneisminelsafasmflsfaslfmlf
> lflsfldfmdlfldfldfloer" with out any space. 
> 1. Can I replace all the 'l' character with value say 'jay'
> 2. Or can I replace each occurance of 're' with 'ki'
> something like that.
> 
> I think pattern replacement will not support this!!!
> 
> Is there any way to do that? Help me in that.
> 
> Thanks,
> Nagarajan M.
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message