http://qs1969.pair.com?node_id=286986

nofernandes has asked for the wisdom of the Perl Monks concerning the following question:

Hello sapient Monks,

I have a file that contains various information. Each kind of information has a specific tag, like xml or html, but is not a document of this type.

The file is like this:

<FMS> <HEAD> ORADEV61 GL_FORMS FULL_ANALYSIS ORAFORMS50 GET_DATABLOCK_REFS </HEAD> [<OPEN_API> Server8i User1 READABLE passworduser1 </OPEN_API>] <MOD> <NOT_REANALYZED> "G:\GL_FORMS_4\gsdl.fmb" GL "G:\GL_FORMS_4\glccat.fmb" GL "G:\GL_FORMS_4\glsdcnv.fmb" "G:\GL_FORMS_4\glcovsca.fmb>" GL </NOT_REANALYZED> <EXTERNAL> </EXTERNAL> <REANALYZED> "G:\GL_FORMS_5\glsss.fmb" GL "G:\GL_FORMS_5\glcxcvat.fmb>" GL "G:\GL_FORMS_5\glcsdsnv.fmb" GL "G:\GL_FORMS_5\glcqsoa.fmb" "G:\GL_FORMS_5\glcqsdvur.fmb" "G:\GL_FORMS_5\gldeqsdf.fmb" GL "G:\GL_FORMS_5\glg xf rp.fmb" GL "G:\GL_FORMS_5\gljou.fmb.fmb" GL "G:\GL_FORMS_5\gl sou.fmb" "G:\GL_FORMS_5\gl sou2.mmb.mmb" GL </REANALYZED> </MOD> </FMS>

My purpose is too erase the content within the <REANALYZED> and </REANALYZED> or any other tags and substitute for a new one..new files!

What´s the best way to do that??

Must i use regex or is there a module to do this kind of operations?

Thank you for your valuable help.

Nuno

edited by ybiC: removed funky ¶ EOL chars