Modify in xml in multiple files

Hello,

Personnel I need to modify a value inside an xml node, the problem is that I need to do this in 1300 files at once, the value I look for inside the node can be anyone, it makes no difference the value that is there, I just need to modify this node in all files at once, example:

Em um xml pode estar
    <VDesc>9.32</vDesc>
Em outro
    <VDesc>1.45</vDesc>

Em assim por diante.

Preciso modificar em todos arquivos para
    <VDesc>0.00</vDesc>

Just that, any suggestions, what tool to use?

Author: Linces Marques, 2016-09-05

2 answers

Based on all the answers I managed to solve the problem in a simple and very effective way, I did the following:

With Notepad ++

Option: "Find->Override, Tab Find in files", in the field Find put: {3-some]}

<vICMSDeson>(\s*\d+\.\d+\s*)<\/vICMSDeson>

, and in the field replace with, I put:

<vICMSDeson>0.00</vICMSDeson>

, in filters I put: *.xml to search only in xml files, then in Pasta I indicated the path of the xml files, in search mode I selected "regular Expression". Perfect.

Might be useful to someone else.

Thank you all

 2
Author: Linces Marques, 2016-10-24 03:12:46

If you can use perl, there goes a suggestion:

perl -i -pe 's!<VDesc>.*?</VDesc>!<VDesc>0.00</VDesc>!s' *.xml

If you prefer to create a backup of the original (a.xml , a.xml.bak):

perl -i.bak -pe 's!<VDesc>.*?</VDesc>!<VDesc>0.00</VDesc>!s' *.xml

(I assumed the V, v to be V)

 0
Author: JJoao, 2016-09-05 17:02:01