You are viewing illiterat

James Antill - September 26th, 2011

Sep. 26th, 2011

03:05 pm - XML grep

For a long time I've wanted to be able to do an "XML grep" on XML data, where I see just the nodes I care about in an XML file. After recently hitting this problem again, I found out about xmlstarlet and after a _lot_ of work I managed to get what I wanted. So I figured I'd write it down, for both of us:

xmlstarlet sel -I -t \
  -m '/updates/update' \
  -i 'pkglist/collection/package[@name="raydium"]' \
  -c . \

...I'll explain each line of the above:

Tags: ,
Previous day (Calendar)