I would like to programmatically update a string in a very simple XML config file, such as this:
<?xml version="1.0"?> <x> <z>should be changed</z> </x> <y> <z>should NOT be changed</z> </y>
Does a simple CLI command exist that will update x/z and NOT y/z ? Perhaps with an XPath selector argument, such as:
$ xml-update myfile.xml /x/z "my new string"
I could write something in Perl or Python, but given the simplicity of this problem, I guess there must be a clever Unix utility that does this already.
Update: I found this but it seems a bit overkill. And I would have to learn XSLT first. http://developerblog.redhat.com/2013/12/05/xml-editing-bash-script/