Extracting the value of an middle attribute tag from XML

Hi All,

Please help me out in resolving this..

<secondTag enabled='true' processName='test1' pidFile='/tmp/test1.pid' />

From the above tag, I'm trying to retrieve the value of enabled and pidFile attributes by means of processName attribute.

Would be thankful in resolving this.. Waiting for the reply..

awk -F\' '{print $2,$6}' infile

what do you mean by "by means of processName attribute"

I have a service running with test1.. The tag added is of watchdog related config.. I'm checking the health status of the test1 process using watchdog. I need to display whether the process test1 is enabled or not and path where I could find the pidFile..

In addition to the above, I want to retrieve the values of enabled and pidFile by means of processName. It is because, I have defined 30 tags of these type to check the health status.

The processName is unique among the file..

$ awk '$3 ~ test1 {printf "%s\n%s\n", $2, $4}' infile
enabled='true'
pidFile='/tmp/test1.pid'

Try:

awk -F\' '$4==pname{print $2,$6}' pname="test1" RS=\< infile

@fpmurphy
This happens to work with this input because variable test1 is empty, and therefore there is a match with an empty string. IMO there should be double quotes around "test1"