Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Find and Replace in Text / XML file

Status
Not open for further replies.

tbg130

Programmer
Aug 11, 2004
46
CA
Hi All,

I'm looking for a way to find and replace a block of text across multiple files. The files are .cfg files written with an XML style code. Each file is in a different folder for which I could identify easily. The subset of code that I'd want to replace, at least initially, may be different, but once they have all been replaced once, would be the exact same as they would all get updated with the same information nightly. The formatting of the subset of code would look like the following:

<code line 1>
<code line 2>
<code line 3>
<opentag>
<datapoint1>data</datapoint1>
<datapoint2>data</datapoint2>
<datapoint3>data</datapoint3>
...
</opentag>
<code line 4>
<code line 5>
<code line 6>

I need to replace everything from <opentag> to </opentag> with a new set of data on a nightly basis. I'm looking for a script that can be run from a DOS batch command to do this for me; or, some other easy way to automate it on a schedule.

Any assistance would be much appreciated as I'm dying trying to maintain a variety of data sets for different clients...

Thanks in advance to all.

Tyler
 
Looks more like an editing problem than an XML problem to me. Do you know any languages that support regular expressions? This would become trivial if you do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top