Friday, 15 March 2013

Is there anything to convert HTML special characters in files to normal characters? -


I have some source code files that came to me by an HTML output, so they are very useless.

I have such things:

 % include & amp; Quot; Macros.mac & amp; Quot;  

Which one should be:

 % include "macros.mac"  

Is there a script (sh , Pearl, Batch, ...) are suitable characters to change each file (about 200)? In the letters & amp; Lieutenant; , & amp; Gt; , ... (I place a location in the middle so that they do not convert them to

thanks, it has been highly appreciated.

< / Div>

If it's just four & " characters, Sed is about (1) can help:

  sed 's / & amp; quot; / "/ g; s / & amp; lt; / & Lt; / g; s / & gt; & gt; / g; s / amp; / amp; / amp; / g>  

Update : My original offer was following and there was a bug:

  sed 's / & amp; amp; / & amp; g; s / & Amp; quot; / "/ g; s / & amp; lt; / & gt; / g; s / & gt; & Gt; / g ' 

This should be changed in ">" & amp; gt; that is false.


No comments:

Post a Comment