strip comments from xml file and pretty-print it
bash, sh, xml
Solution
you can use tidy
$ tidy -quiet -asxml -xml -indent -wrap 1024 --hide-comments 1 tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<user username="qwerty" password="ytrewq" roles="manager-gui" />
</tomcat-users>
Problem
I have this huge xml file which contains a lot of comments. Whats the "best way" to strip out all the comments and nicely format the xml from the linux command line?