Skip to content

Instantly share code, notes, and snippets.

@ryanmaclean
Forked from AggroBoy/gist:1242257
Last active August 29, 2015 14:22
Show Gist options
  • Save ryanmaclean/5c75597c3a65ec4b7c21 to your computer and use it in GitHub Desktop.
Save ryanmaclean/5c75597c3a65ec4b7c21 to your computer and use it in GitHub Desktop.
Escape XML with Sed
sed -e 's~&~\&amp;~g' -e 's~<~\&lt;~g' -e 's~>~\&gt;~g' -e 's~\"~\&quot;~g' -e "s~\'~\&apos;~g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment