Commit 4ee573cf authored by Bastien Durel's avatar Bastien Durel
Browse files

cleanup each time

parent 185afe29
if [ -r covid.csv ]; then
date=$(stat -c %y covid.csv)
rm -f covid.csv covid_corrected.csv
wget -O covid.csv -cq
date_new=$(stat -c %y covid.csv)
if [ "$date" != "$date_new" -o ! -r covid_corrected.csv ]; then
sed -E 's@([0-9]+)/([0-9]+)/([0-9]+)@\3-\2-\1@' \
sed -E 's@([0-9]+)/([0-9]+)/([0-9]+)@\3-\2-\1@' \
< covid.csv | sed 's/\r$//' | \
grep -v "^;" | \
grep "-" > covid_corrected.csv
psql -h -U bastien \
psql -h -U bastien \
-c "truncate covid;COPY covid FROM stdin DELIMITER ';' CSV HEADER;" \
< covid_corrected.csv
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment