xml escape

Escape special XML characters, e.g. <a1>&lt;a1&gt;. More information: https://xmlstar.sourceforge.net/doc/xmlstarlet.pdf.

xml escape "{{<a1>}}"

echo "{{<a1>}}" | xml escape

xml escape --help