Log in

No account? Create an account

XML grep - James Antill — LiveJournal

Sep. 26th, 2011

03:05 pm - XML grep

Previous Entry Share

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


[User Picture]
Date:September 26th, 2011 10:50 pm (UTC)


Very happy that someone is using this Fedora package which I've maintained for a long time. It's an interesting little toolkit though I wouldn't go so far as to call it user friendly. Glad it was of use for you.
(Reply) (Thread)