Add days step option

This commit is contained in:
poka 2020-06-18 04:13:51 +02:00
parent 804b5fe779
commit a9fefe0932
1 changed files with 9 additions and 5 deletions

View File

@ -1,21 +1,25 @@
#!/bin/bash
# Varialbes
n=1 # Nombre de jours pour les pas en abscisse
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
if [[ -e $SCRIPTPATH/.env ]]; then source $SCRIPTPATH/.env; else echo "Veuillez créer votre fichier .env inspiré de .env.example" && exit 1; fi
rWallets=$(cat $WEBPATH/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
j=1
for i in $rWallets; do
if [[ $j == 0 ]]; then
! [[ $j =~ ^(0|1)$ ]] && ((j--))
if [[ $j == 1 ]]; then
dateN=$i
cp tpl/graph.json rWallets-$i.json
sed -i s/_DATE/$i/g rWallets-$i.json
j=1
else
j=0
elif [[ $j == 0 ]]; then
result+=$(sed s/_RWALLET/$i/g rWallets-$dateN.json)
rm rWallets-$dateN.json
j=0
[[ $n == 1 ]] && j=1 || j=$((n*2))
fi
done