I have a XML file(MyXML.xml) like this :<?xml version=1.0 encoding=UTF-8?><S:Envelope xmlns:S=http://schemas.xmlsoap.org/soap/envelope/>    <S:Body>        <ns3:GetAllInfoFromRest xmlns:ns2=http://com.lanuk.cfe/b2_7/service/objects xmlns:ns3=http://com.lanuk.cfe/b2_7/service/operations>            1111,GH43567,Hamburger,GET,278598655,\n000001,                    ,Kunal,Bhyuo,Ramond,856 K. 98 Rd,                                        ,                                        ,Tripura,AGT,INDIA,856987,                    ,S,S,S,8956,\666666        </ns3:GetAllInfoFromRest>    </S:Body></S:Envelope>Now i need to strip out the SOAP content and all the tag attributes from this xml and get only the string response 1111,GH43567,Hamburger,GET,278598655,\n000001,                    ,Kunal,Bhyuo,Ramond,856 K. 98 Rd,                                        ,                                        ,Tripura,AGT,INDIA,856987,                    ,S,S,S,8956,\666666.How can i do it with awk or  sed ?I tried it in this  way :$ xgawk -lxml 'XMLATTR[xmlns:ns3]==http://com.lanuk.cfe/b2_7/service/operations{print $2}' MyXML.xmlBut obviously I am making some mistake  due to which it is not working. Can some one suggest any other way around this ?
How to find out the content of a XML file using Unix Sed/Awk?
sed;awk;xml
sed/awk are really about regular expressions.check this answer on stackoverflow why parsing HTML/XML with regular expressions is a bad idea.for XML you really need to build a DOM of the document and then find your information. there are cmdline tools like xmlstar that allow you to get information out of XML-documents.but do not try using sed/awk to parse XMLPS: of course, you might be able to create a simple regular expression that can extract the information needed on the files you happen to encounter in real life.e.g. the following will print the 5th line of the document, which (in your example) holds the relevant information.# stupid and naive approach:sed '5!d' MyXML.xmlbut this makes an assumption about the layout of the file, which has nothing to do with XML. it might work for a very specific generator of the given file, but is not guaranteed to work with any XML-file following the same structure (and structured data is what XML is all about)