Problem printing the property of xml file via shell script

Hi,
I have a config.xml which cointains the tags like
<CONFIG>
<PROPERTY name="port" value="1111"/>
<PROPERTY name="dbname" value="ABCDE"/>
<PROPERTY name="connectstring" value="xyz/pwd"/>
</CONFIG>
This file is in some directory at UNix box.
I need to write a shell script to echo the dbname.

Please help me with the sample shell script fpr this.

Thanks in advance

sed -n 's%<PROPERTY name="dbname" value="\([^"]*\)".*%\1%p' file.xml

The proper way to do it is with XSLT but if this is all you need, that's overkill.

 awk -F'"' '$2=="dbname" {print $4}' file.xml

Thanks for the reply..
But is there a way to do this in awk?

Neha

[n]awk '{
  if ($2 ~ /dbname/) {
     gsub(/(^.*=\"|\"\/>$)/,"",$NF)
     print $NF
  }
}' file