Monday, January 7, 2019

Beautify already correct xml content with easy vi/vim spell...

Need to edit out nodes from massive computer generated xml files that don't feature formatting for human eyes in the interest of preventing early onset blindness? Use this handy vi trick (requires xmllint be installed)...

:%!xmllint --format %

presto human friendly formatting for monolithic xml files with no indenting or newlines etc.

Before....

and voila....

If this throws an error on ubuntu (indicating not installed), install libxml2-utils and all will be well.

No comments:

Post a Comment