(see solution below)
I have XML files which I parse with a Python script (I did not write it but it does the job perfectly). The problem is that the XML file is large (~ 1GB) and the parsing take ages due to memory congestion. The XML file is full of useless information in certain elements - what would be the best way to get rid of them? I tried xmlstarlet but it is too "XML-oriented", ie. it takes ages for the same reasons that the Python script.
What I just need to do is to get rid of given elements in a dumb way: remove everything between
</mytag> all through the file (there are multiple
<mytag>...</mytag> pairs, all to be removed).
I would really appreciate your ideas since I am sure there are good ways to do that without reinventing the wheel.
EDIT: I finally ended up with
perl -pe "undef $/;s/<mytag>.*?<\/mytag>//msg" < inputfile.xml > outputfile.xml
which I did not realize @Vlad posted as well.