awk to retrieve the particular value from a same list of xml tags

Hi All,

I have the following code in one of my xml file:

<com:parameter>
	<com:name>secretKey</com:name>
	<com:value>31XA874821172E89B00B1C</com:value>
</com:parameter>
<com:parameter>
	<com:name>tryDisinfect</com:name>
	<com:value>false</com:value>
</com:parameter>
<com:parameter>
	<com:name>scannerThreadCount</com:name>
	<com:value>10</com:value>
</com:parameter>

Now, I want to retrieve the <com:value> for "secretKey" Parameter. Please help me out..

awk '$0 ~ "<com:name>secretKey<\/com:name>" {getline;FS=">|<";print $3}' file

Throwing the following error while executing the awk command:

awk -F"<|>" '/<com:name>secretKey</ && getline{print $3}' infile
1 Like

man ("Scrutinizer")
if the code is in the following:

<name>Email Address Encryption</name>
      <className>com.ciphercloud.tokenizers.impl.EmailAddressEncryptorImpl</className>
<tokenWrapConfig>
      <name>Base36</name>
      <scheme>0</scheme>
      <version>0</version>
      <prefix>zqx1</prefix>
      <suffix>1xqz</suffix>
</tokenWrapConfig>

how to retrieve the "Email Address Encryption" value ie., first <name> value using <scheme> tag from the above code?:o