misp-taxonomies/jq_all_the_things.sh

28 lines
700 B
Bash
Raw Normal View History

2017-02-13 12:01:05 +01:00
#!/bin/bash
2019-01-28 16:10:11 +01:00
# Seeds sponge, from moreutils
#Validate all Jsons first
for dir in `find . -name "*.json"`
do
echo validating ${dir}
# python3 -c "import json; f_in = open('${dir}'); data = json.load(f_in); f_in.close(); f_out = open('${dir}', 'w'); json.dump(data, f_out, indent=2, sort_keys=True, ensure_ascii=False); f_out.close();"
cat ${dir} | jq . >/dev/null
rc=$?
if [[ $rc != 0 ]]; then exit $rc; fi
done
2017-02-13 12:01:05 +01:00
set -e
set -x
# Seeds sponge, from moreutils
2017-02-13 12:02:51 +01:00
for dir in ./*/machinetag.json
2017-02-13 12:01:05 +01:00
do
cat ${dir} | jq . | sponge ${dir}
done
cat schema.json | jq . | sponge schema.json
2017-08-31 23:16:36 +02:00
cat schema_mapping.json | jq . | sponge schema_mapping.json
2017-02-13 12:01:05 +01:00
cat MANIFEST.json | jq . | sponge MANIFEST.json