Parsing and getting data from XML file using ksh script

Hi All,

I have a xml file for example as described below

<xml>
<address>
<street><street>
<address/>
<isbn>426728783932020308393930303</isbn>
<book>
<name>
</name>
</book>
.
.
.
</xml>

My problem is to get the isbn number from the above described file using ksh script. Could anybody help me in solving this issue?

Thanks,
Vinna

sed -n -e "s/<isbn>\([0-9]*\)<\/isbn>/\1/p" file.xml

shouldn't this be,

sed -n -e "s/<isbn>\([0-9]*\)<\/isbn>/\1/p" file.xml

more better

sed -n -e "/<isbn>/s/<isbn>\([0-9]*\)<\/isbn>/\1/p" file.xml

Yes and thanks.

In the above defined xml file, all the tag elements are defined in a single line. Then how to get isbn?

for example:

<xml><address><street><street><address/><isbn>426728783932020308393930303</isbn><book><name></name></book>...</xml>

Thanks,
Vinna

echo "<xml><address><street><street><address/><isbn>426728783932020308393930303</isbn><book><name></name></book>...</xml>" | sed -n 's/^.*<isbn>\([0-9]*\)<\/isbn>.*$/\1/p'