How do I parse a xml line for ExtData tags, which has some complex value, I need to mask it like this : For eg:
<ExtData>Name="Jason" Value="Special"</ExtData> to <ExtData>Name="Jason" Value="XXXXXXX"</ExtData>
I need to mask ExtData tag value like above only when Name is Jason or some set of name, and not for every Name.
For eg: if "DummyName" is not in set of names, than I do not want to change this below line.
<ExtData>Name="DummyName" Value="Garbage"</ExtData>
I need to do all this in bash/shell script.
Bottom line is, I want to read a file line by line, say, via sed command. Check for ExtData tag in the line. If matched, Read the text between ExtData tag and /ExtData tag. In this text, extract Name. If Name is from a set of names, then mask its corresponding "Value" data with equal number of 'X'.
Please let me know how to achieve the above task.
Thanks !! Puneet