Monthly Archives: November 2016

Escaping XML with Sed

There are five XML characters that need to be escaped: ” &quot; ‘ &apos; < &lt; > &gt; & &amp; And here is the solution ruakh provided over on stackoverflow sed ‘s/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/”/\&quot;/g; s/'”‘”‘/\&#39;/g’

Posted in General | Leave a comment