Monthly Archives: November 2008

Introducing gxpp

Here’s another little tool which I use all the time.  It’s like grep, but for XML documents.  By using XPath expressions you can easily pull information out of XML documents to use in your shell scripts.  It’s great for digging through XML documents for that one fields which you need.

I use it a lot in cluster testing to get a list of node names from cluster.conf.

[root@morph-03 ~]# gxpp '//clusternode/@name' /etc/cluster/cluster.conf
tank-01
tank-03
tank-04
morph-01
morph-03
morph-04

It’s also very useful when used with collie as shown in Collie Gxpp Tricks.  In that wiki page I also talk about gxpd which deletes sections from an XML file and gxpm which makes it easy to insert new sections into an XML document.

The source code for this project is in my public_git directory on fedorapeople.

git clone git://fedorapeople.org/~nstraz/gxpp.git