I have python script that parse xml file and execute commands. I want my xml to read another xml file and edit it. For that i used perl command
"perl -pi -0777 -e 's@<en:TagName>.*?</en:TagName>@<en:TagName>new-value</en:TagName>@sg'FileName.xml"
This i have added in my xml file that is parsed by shell script.
<cmd>perl -pi -0777 -e 's@<en:TagName>.*?</en:TagName>@<en:TagName>new-value</en:TagName>@sg'FileName.xml</cmd>
here my python script is treating <en:TagName> as a tag and is not able to parse it. So i added "perl -pi -0777 -e 's#<en:TagName>.*?<en:TagName>#<en:tagName>new-value</en:TagName>#sg' FileName.xml" and also used “#” as delimiter(as @ is special character in shell script that we are using)
Putting # is not able to provide desired result. Instead of replacing it is appending new value at the end.
Surround your perl commands with
CDATAtags: