I have a file a.xml contaning:
<customerId>999</customerId>
<aaa>09876</aaa>
Now I want to extract the value '999' and save it in a variable and then export the variable. Something like the below:
export CUSTOMER_ID=cat a.xml |grep customerId |awk -F ">" '{print $2}' |awk -F "<" '{print $1}'
Whereas
cat a.xml |grep customerId |awk -F ">" '{print $2}' |awk -F "<" '{print $1}' is giving the expected result i.e. 999
But when I want to save it in a variable, it is not working
. Please help me urgently. My Operating System is SUSE Linux.