Created
July 5, 2017 12:13
-
-
Save mkutsevol/6cdc1d2455991a0e658143e582064e20 to your computer and use it in GitHub Desktop.
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 | |
for file in $(find . -name '*.json'); do | |
res=$(python -c 'import sys, json; print json.dumps(json.load(sys.stdin), sort_keys=True, indent=2)' < $file || echo $file has syntax errors!); | |
if ! echo "$res" | diff -q - $file >/dev/null;then | |
echo processing $file | |
echo "$res" > $file | |
fi | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment