Skip to content

Instantly share code, notes, and snippets.

@mkutsevol
Created July 5, 2017 12:13
Show Gist options
  • Save mkutsevol/6cdc1d2455991a0e658143e582064e20 to your computer and use it in GitHub Desktop.
Save mkutsevol/6cdc1d2455991a0e658143e582064e20 to your computer and use it in GitHub Desktop.
#!/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