XML parsing by UNIX

@Yoda: i am not getting the required output if i use 2 whole files in this script.

I think I got the problem. In your original XML file, the tags are all in one single line. This is the reason why the code is not working.

I didn't copy your original XML, but instead I actually opened the XML in IE which shows tags in proper hierarchy, copied it and worked on this code.

You can modify the existing code by adding a for loop to read, perform the necessary checks and finally edit the values.

1 Like

Yeah.....but I am not able to parse the xml files....can u pls post the code....I am learning the awk.

What exactly did you try and in what way did it not work? Be specific. "not work" is useless -- you're asking us to redo everything over and over from scratch with little to no assurance that you're able to follow our instructions at all, especially when you gave us bad input from the get-go and didn't realize.

We can help fix problems but are not a free script-writing service.

i got your prob. see my question is clear. i got my answer frm yoda.
but if i use 2 whole xml file,i didn't get any changes.
if you use 2 whole files,you will get the prob. i didn't understand how do i change the file. i got the changes if i use fragment of the data.
if i gave bad inputs,sorry for that.
thanks all of you for helping me.

If you iknow it does not damage the xml, you can force a line feed before every <, so all tags start on the front of one line and end on the front of a subsequent one. Parsing such a file with text tools is now much simpler.

Damage occurs if there is a literal string inside elements, perhaps an encoded LOB, that is corrupted by adding a trailing line feed. However, the app or the decoding itself may discard line feeds, like uuencode and base 64 but not urlencode. Best way to encode text data for XML in Java? - Stack Overflow