curena
3/16/2017 - 4:56 PM

Parse XML using Bash

Parse XML using Bash

#Given an xml file named foo.xml containing a tag called "booie"
xmllint --xpath "string(//booie)" foo.xml

#You can perform string manipulation options to obtain the value you want.
xmllint --xpath "string(//booie)" foo.xml | grep -o '\d\d\d'