Friday, April 15, 2011

Delete a set of elements in a xml file

Recently I wanted to delete a certain search pattern in an XML file. Within the XML file I had a XML snippet;

and i wanted to delete the commented out part. I was able to do it with this, search replace command in vim.

:%s/<!--moved to nexus\_.\{-}-->

I got this to working by looking at the mail[1]
its a handy command once you couple it with a vim macro.