Grep and Sed Equivalent for XML Command Line Processing

Joseph Holsten picture Joseph Holsten · Sep 18, 2008 · Viewed 69.3k times · Source

When doing shell scripting, typically data will be in files of single line records like csv. It's really simple to handle this data with grep and sed. But I have to deal with XML often, so I'd really like a way to script access to that XML data via the command line. What are the best tools?

Answer

Russ picture Russ · Sep 18, 2008

I've found xmlstarlet to be pretty good at this sort of thing.

http://xmlstar.sourceforge.net/

Should be available in most distro repositories, too. An introductory tutorial is here:

http://www.ibm.com/developerworks/library/x-starlet.html