0

I want to find some text in the xmls files and want to replace the text with the given input when i run the batch file.

Eg: below is the part of the xml file:

pubdate type="online" year="2015" month="01" day="05"

In the above xml line I want to replace: Year:xxxx month:xx day:xx

All these three feilds should prompt me to input when batch file is run for multiple xmls and all the xmls within the batch file folder should replaced with given input year, month and day.

sample input: 2015/01/10. sample out put: pubdate type="online" year="2015" month="01" day="10"

The batch file should search above line and replace the year month and day with the input. Input format is yyyy/mm/dd

Thank you very much. Kulkarni

Hi there,

Below is the sample XML.

Iam having bulk of xmls like this, and i want to change the year month and date in the below mentioned tag:

For all xml i want to replace the differnt values so script should ask the year, month and day to replace and it should fine the above mentioned tag in the xmls and should replace the inputted values. I checkd related articles and sorry to tell you i didn't try with any code as i'm new to scripting!

    <hst>
        <re year="2014" month="07" day="12"/>
        <acc year="2014" month="11" day="17"/>
        <pubdate type="online" year="2014" month="12" day="19"/>
    </hst>
  • Please show a sample inut and output in-context. – Magoo Dec 30 '14 at 10:08
  • sample input: 2015/01/10 and the sample out put: pubdate type="online" year="2015" month="01" day="10" the batch file should search above line and replace the year with the input.input format is yyyy/mm/dd – girish kulkarni Dec 30 '14 at 11:32
  • What is your find string(existing line) in your XML file that you want to replace with the pubdate type="online" year="2015" month="01" day="10"? Providing the sample lines would help. Have you tried any code? – gbabu Dec 30 '14 at 19:02
  • Take a look on [XMLStarlet does not print full line](http://stackoverflow.com/questions/27581968/), [How to parse an XML file to get tag values and handle greater than and double quote characters](http://stackoverflow.com/questions/27584352/) and [How can I find and replace string with another string in batch script](http://stackoverflow.com/questions/27604866/) to get ideas on how to code that with a batch script. The easiest method would be the usage of a powerful text editor like UltraEdit which supports a regular expression replace in files which can be even scripted. – Mofi Dec 30 '14 at 22:33
  • hi gbabu, i have updated my question above with more information. could you please suggest! Thank you very much. – girish kulkarni Jan 01 '15 at 15:48

0 Answers0