Skip to content

Instantly share code, notes, and snippets.

@cventour
Last active February 23, 2022 12:43
Show Gist options
  • Save cventour/7498c712de8a9aefffffc3132e5bb0d5 to your computer and use it in GitHub Desktop.
Save cventour/7498c712de8a9aefffffc3132e5bb0d5 to your computer and use it in GitHub Desktop.
Extract covid19.gov.gr infections stats (whole history)
#!/bin/sh
curl https://covid19.innews.gr | gunzip > covid.html
cat covid.html | grep daily_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > daily_stats.json
cat covid.html | grep weekly_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > weekly_stats.json
cat covid.html | grep three_days_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > three_days_stats.json
cat covid.html | grep last_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > today_stats.json
cat covid.html | grep total_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > total_stats.json
rm covid.html
@dspinellis
Copy link

Even better:

curl https://covid19.innews.gr | 
gunzip |
tee >(grep daily_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > daily_stats.json) \
  >(grep weekly_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > weekly_stats.json) \
  >(grep three_days_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > three_days_stats.json) \
  >(grep last_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > today_stats.json) |
grep total_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > total_stats.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment