Use grep to grab a value in between character with a single command :/
I have a file (xml) with the following content:
$cat XXX.xml
<?xml version="1.0" encoding="UTF-8"?>
.
.
.
<subject>
<subjectIdentifier>127_S_5218</subjectIdentifier>
<researchGroup>Patient</researchGroup>
<subjectSex>F</subjectSex>
<subjectInfo item="DX Group">SMC</subjectInfo>
.
.
.
*I want to grep the value specifying the Dx group. In this case SMC. This value will change between different xml files...
So I tried:
$cat XXX.xml | grep "DX Group"
<subjectInfo item="DX Group">SMC</subjectInfo>
But it grep the entire line rather that just the characters i need (e.g. XMC).
Any help?
|