Skip to content

Instantly share code, notes, and snippets.

@jonathanmaron
Created June 22, 2015 04:36
Show Gist options
  • Save jonathanmaron/021fc9a3079a139dced1 to your computer and use it in GitHub Desktop.
Save jonathanmaron/021fc9a3079a139dced1 to your computer and use it in GitHub Desktop.
# strip comments
cat package.xml | sed '/<!--.*-->/d' | sed '/<!--/,/-->/d' > package.tmp.xml
# clean XML file
xmllint package.tmp.xml --format --encode utf-8 | unexpand -t2 | expand -t4 > package.clean.xml
# replace original file
mv package.clean.xml package.xml
# clean up
rm package.tmp.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment