For Example,consider the below line
<WORKFLOWLINK CONDITION ="" FROMTASK ="Start" TOTASK ="cmd_START_RUN"/>
From above line, I need to print Start from FROMTASK ="Start" using grep command or using any command.
For Example,consider the below line
<WORKFLOWLINK CONDITION ="" FROMTASK ="Start" TOTASK ="cmd_START_RUN"/>
From above line, I need to print Start from FROMTASK ="Start" using grep command or using any command.
Try doing this :
$ xmllint --xpath 'string(//WORKFLOWLINK/@FROMTASK)' file
Start
$ xmlstarlet sel -t -v 'string(//WORKFLOWLINK/@FROMTASK)' file
Start
$ saxon-lint --xpath 'string(//WORKFLOWLINK/@FROMTASK)' file
Start
xmllint from libxml2If you just want value of FROMTASK, or some fixed variables try sed:
sed -nre 's/^.*FROMTASK *= *"([^"]*)".*$/\1/p' file
If you want to get value of any variables, try xmllint as sputnick answered
Use sudo apt-get install libxml2-utils(for debian) or yum install libxml2-utils to install it.