Scripting: what is the easiest to extract a value in a tag of a XML file?

Solution 1:

xml2 can convert xml to/from line-oriented format:

xml2 < pom.xml  | grep /project/version= | sed 's/.*=//'

Solution 2:

Other way: xmlgrep and XPath:

xmlgrep --text_only '/project/version' pom.xml

Disadvantage: slow