Hi All,
I am trying to replace the values inside <password> tag in an xml file but it doesn't replace certain passwords:
For eg:
Server/home/sperinc>cat TextXML.txt
<appIds>
<entry name="AccountXref">
<type id="ldap">
<realm>nam</realm>
<id>XXXXXX</id>
<password>![CDATAp6t1a7$p4u6f4*k9]></password>
</type>
</entry>
<entry name="WsRmsAcctAdd">
<type id="XXXXX">
<realm>xdsdev</realm>
<id>OLSEXTERNALCUSTOMER</id>
<password>57aSdfJ8</password>
</type>
</entry>
when i run the below script - O/P is below
awk '
BEGIN { FS = "[<|>]" }
{
if ($2 == "password") {
sub($3,"")
}
print
}
' TextXML.txt > Newfile.txt
The below password is not replaced
<appIds>
<entry name="AccountXref">
<type id="ldap">
<realm>nam</realm>
<id>XXXXXX</id>
<password>![CDATAp6t1a7$p4u6f4*k9]></password>