Last active
April 14, 2020 09:15
-
-
Save ftrvxmtrx/57ae537f4098c7c6d9a247943dffbad7 to your computer and use it in GitHub Desktop.
covid-19: countries (with >=1000 sick) by dead/sick ratio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo '# COVID-19 dead/sick ratio per country' | |
echo '<!-- date '$(date --rfc-3339=seconds | tr ' ' T)' -->' | |
echo | |
echo '```' | |
curl -s https://c19.se/global | html2text -nobs | awk -F ' ' -v 'OFS= ' ' | |
/^\*\*\*\* / { | |
if(lb++) | |
exit 0 | |
next | |
} | |
/^[^.]/ && lb && 0+$4 > 0 && 0+$2 > 1000 { | |
if(NF == 4 && $1 != "T}" && 0+$2 > 0) | |
print $4/$2*100, $1, $2, $4 | |
next | |
} | |
' | sort -nr | awk -F ' ' -v 'OFS= ' ' | |
BEGIN { | |
print "N", "%", "Country", "Sick", "Dead" | |
} | |
{ | |
print NR, $0 | |
} | |
' | tr _ ' ' | column -s ' ' -t | |
echo '```' | |
echo | |
echo 'Only countries with more than 1000 cases are displayed.' | |
echo | |
echo 'Generated using [this](https://gist.github.com/ftrvxmtrx/57ae537f4098c7c6d9a247943dffbad7) script.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment