g1-stats/transform_json.sh

20 lines
644 B
Bash
Executable File

#!/bin/bash
rWallets=$(cat /home/axiom/apps/g1-stats/history/index_*.html | grep -E "Date:|Reçus simples wallets|Reçus simples portefeuille" | awk -F '<b>' '{ print $2 }' | awk '{ print $1 }' | tr -d '.' | tr ',' '.')
j=0
for i in $rWallets; do
if [[ $j == 0 ]]; then
dateN=$i
cp tpl/graph.json rWallets-$i.json
sed -i s/_DATE/$i/g rWallets-$i.json
j=1
else
result+=$(sed s/_RWALLET/$i/g rWallets-$dateN.json)
j=0
rm rWallets-$dateN.json
fi
done
sed "s/_JSONDATA/$result/g" tpl/graph.html > graph.html