mapcomplete/Docs/Tools/csvPerChange.sh

23 lines
661 B
Bash
Raw Normal View History

2021-03-10 12:55:27 +01:00
#! /bin/bash
if [[ ! -e stats.1.json ]]
then
echo "No stats found - not compiling"
exit
fi
rm stats.csv
# echo "date, username, language, theme, editor, creations, changes" > stats.csv
echo "" > tmp.csv
for f in stats.*.json
do
echo $f
2021-03-13 15:49:14 +01:00
jq ".features[].properties | [.date, .user, .metadata.language, .metadata.theme, .editor, .create, .modify, .comment, .metadata.host]" "$f" | tr -d "\n" | sed "s/]\[/\n/g" | tr -d "][" >> tmp.csv
2021-03-10 12:55:27 +01:00
echo "" >> tmp.csv
done
2021-03-21 02:46:33 +01:00
sed "/^$/d" tmp.csv | sed "s/^ //" | sed "s/ / /g" | sed "s/\"\(....-..-..\)T........./\"\1/" | sort >> stats-latest.csv
cat stats2020.csv stats-latest.csv > stats.csv
2021-03-10 12:55:27 +01:00
rm tmp.csv