linux - How to write a bash script that can parse through an XML file as input and remove certain elements from the file -


i need create bash script manipulates following sample xml file:

  1. check particular id , remove xml branch id.
  2. the id's read text file.

    <?xml version="1.0"?> <cmtf xmlns="urn:rm_upms_cmtfenvelopeschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <data xmlns=""> <entitygroup entityname="people">   <person xmlns="abc">     <id ns="">12280</id>     <pin xmlns="">erererre</pin>     <name xmlns="">ereffdef</name>   </person>   <person xmlns="bbc">     <id ns="">5567</id>     <pin xmlns="">erererre</pin>     <name xmlns="">ereffdef</name>   </person>   <person xmlns="bbc">     <id ns="">3347</id>     <pin xmlns="">ededed</pin>     <name xmlns="">rtreer</name>   </person>   <person xmlns="bbc">     <id ns="">3249</id>     <pin xmlns="">erererre</pin>     <name xmlns="">ereffdef</name>   </person> </entitygroup> </data> </cmtf>  

here, need remove <person> tag entries have id 12280, 3249 being read text file.

perhaps use php this: running php script (php function) in linux bash

and domdocument(http://php.net/manual/en/class.domdocument.php) read , right xml.

of course assumes have php installed.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -