FreeKB - Linux Commands xml_grep (parse XML file)
Linux Commands - xml_grep (parse XML file)

Let's say you have an XML file named example.xml with the following.



The xml_grep command can be used to parse the XML file for certain data.

~]# xml_grep 'id' example.xml
<?xml version="1.0" ?>
<xml_grep version="0.9" date="Thu Aug 17 20:59:36 2017">
<file filename="example.xml">


By default, xml_grep will display quite a bit of output. The --text_only option can be used to only display the value in a certain XML tag.

~]# xml_grep 'id' example.xml --text_only


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 1b29c in the box below so that we can be sure you are a human.


September 16th, 2020 by Ramnath
Thank you

Web design by yours truely - me, myself, and I   |   |