Log in

Post a comment - James Antill

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: ,

Leave a comment:

No HTML allowed in subject


Notice! This user has turned on the option that logs your IP address when posting. 

(will be screened)