Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bastien Durel
coviz
Commits
4ee573cf
Commit
4ee573cf
authored
Nov 18, 2020
by
Bastien Durel
Browse files
cleanup each time
parent
185afe29
Changes
1
Hide whitespace changes
Inline
Side-by-side
get.sh
View file @
4ee573cf
#!/bin/bash
if
[
-r
covid.csv
]
;
then
date
=
$(
stat
-c
%y covid.csv
)
else
date
=
""
fi
rm
-f
covid.csv covid_corrected.csv
wget
-O
covid.csv
-cq
https://www.data.gouv.fr/fr/datasets/r/63352e38-d353-4b54-bfd1-f1b3ee1cabd7
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@'
\
< covid.csv |
sed
's/\r$//'
|
\
grep
"-"
>
covid_corrected.csv
psql
-h
postgresql.cloud.data.fr
-U
bastien
\
-c
"truncate covid;COPY covid FROM stdin DELIMITER ';' CSV HEADER;"
\
< covid_corrected.csv
fi
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
postgresql.cloud.data.fr
-U
bastien
\
-c
"truncate covid;COPY covid FROM stdin DELIMITER ';' CSV HEADER;"
\
< covid_corrected.csv
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment