Created
December 14, 2015 17:50
-
-
Save diegogslomp/013c4220f67eb7008988 to your computer and use it in GitHub Desktop.
Simple bash script to pretty-print json files with json.tool python module
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 | |
set -e | |
if [[ "$#" -eq 1 ]] && [[ -r "$1" ]]; then | |
while IFS='' read -r line || [[ -n "$line" ]]; do | |
echo "$line" | python -m json.tool | |
done < "$1" | |
else | |
echo "jsonview.sh" | |
echo "Usage: jsonview.sh <jsonfile>" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment