XML parsing in a shell script.

Below is a XML I have...

<?xml version="1.0" encoding="UTF-8" ?>
<component 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:XXXXX-www-Install-Manifest manifest.xsd"
        xmlns="urn:qqqqq-Install-Manifest" 
        name="OM" 
        version="4.1.1.1002"
        incremental="false" 
        description="This is the installable for OM 4.1.1.1002 build 201009011545"
        compType="core" 
       compDescription="Order Management">
.
.
.
. some other elements.
.
.
.
.
.
</component >

I want grep the attributes below from the "component " element

version="4.1.1.1002"
description="This is the installable for OM 4.1.1.1002 build 201009011545"

from the xml.

I dont want to use perl or java as its simple xml.

something like

sed -n '/\<component/,/.*>/p' infile.xml | grep -E 'version=|description='
1 Like