Created
October 24, 2017 17:52
-
-
Save djuber/c0ad2b76e0a7dd960d88f1331ac2312b to your computer and use it in GitHub Desktop.
xml pretty print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$#" = "0" ]] | |
then | |
echo "usage: $0 \$infile \$outfile" | |
echo "expects an xml infile, optionally write output to outfile, default is write to stdout" | |
else | |
if [[ "$#" = "1" ]] | |
then | |
cat "$1" | xmllint --format - | |
else | |
cat "$1" | xmllint --format - > "$2" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment