[LearnAdmin] How to parse xml tags in bash or retrieve xml tag values in linux

2 views
Skip to first unread message

Naresh Surampudi

unread,
Apr 10, 2014, 5:13:06 AM4/10/14
to learnadmin+g...@googlegroups.com

Consider the following example file test.xml



        1
        test123
        2
 


 grep -E -m 1 -o "(.*)" test.xml

This will return "test123"


if you want only the value we need to pipe it further

grep -E -m 1 -o "(.*)" test.xml | sed -e 's,.*\([^<]*\).*,\1,g'

This will return "test123"

--
Posted By Naresh Surampudi to LearnAdmin at 4/10/2014 02:43:00 PM
Reply all
Reply to author
Forward
0 new messages