Topic
  • No replies
suresh.h@techsa.net
suresh.h@techsa.net
18 Posts

Pinned topic Search for a File and Replace the content of the file

‏2013-03-01T04:27:42Z |
Hi Team i have Search for a File and Replace the content of the file.

This is the Action

// store the file location -- store the file location or ("C:\Program Files\Software\config.cfg";"C:\Software\config.cfg")
parameter "filename" = "{pathname of file ("C:\Program Files\Software\config.cfg") whose (exists lines whose (it contains "HostPort=")of it )}"

parameter "textToReplace" = "HostPort="
parameter "newText" = "//HostPort="

// iterate through the file replacing lines as necessary
appendfile {concatenation "%0d%0a" of ( if (it contains (parameter "textToReplace")) then ((preceding text of first (parameter "textToReplace") of it) & (parameter "newText") & (following text of first (parameter "textToReplace") of it) ) else it ) of lines of file (parameter "filename")}

// backup the old file
move "{parameter "filename"}" "{parameter "filename"}.bak"
// replace with the new file
move __appendfile "{parameter "filename"}"

========================================================================================================================================
========================================================================================================================================
this the path

i want to replace content in the xml file
C:\ORSS17022\Server\pos\config\lmgDefaultDataTechnician.xml
want you want to change

textToReplace

<OPERATION class="LMGJdbcLookupForPGV" name="ValidatePGVForIssue" package="com.lmg.domain.arts">
<COMMENT>
This operation reads is PGV item.
</COMMENT>
</OPERATION>

newText
<OPERATION class="LMGJdbcLookupForPGV" name="ValidatePGVForIssue" package="com.lmg.domain.arts">
<COMMENT>
This operation reads is PGV item.
</COMMENT>
</OPERATION>

<!-- Changes for CenterPoint PGV Requirement Start -->
<OPERATION class="LMGJdbcLookupForItemConcept" name="LookupForItemConcept" package="com.lmg.domain.arts">
<COMMENT>
This operation reads is PGV item.
</COMMENT>
</OPERATION>
<!-- Changes for CenterPointPGV Requirement End -->

===========================================================================================================

Please help me to resolved the issue.

i am unable to create script plz help