Skip to content

Instantly share code, notes, and snippets.

@ftrvxmtrx
Last active April 14, 2020 09:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ftrvxmtrx/57ae537f4098c7c6d9a247943dffbad7 to your computer and use it in GitHub Desktop.
Save ftrvxmtrx/57ae537f4098c7c6d9a247943dffbad7 to your computer and use it in GitHub Desktop.
covid-19: countries (with >=1000 sick) by dead/sick ratio
#!/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