Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Corona Stats
Here is a script you can use to check on the progress of the COVID-19 virus. I saw a video on it by Luke Smith about a week ago and I've taken his script and modified it. It uses curl to download the data from John Hopkins University and displays the data for the US and the world. The downloaded chart is world-wide so you could add lines to include data from any country of interest.

The display is a bit wide, so I suggest maximizing your terminal window. Depending on the numbers, you may have to adjust the number of tabs in the awk commands to line up right. If you're not in the Eastern time zone you will need to change EDT to your timezone.

# corona-stats

readonly TODAY=$(date '+%d %b %Y')
readonly NOW=$(date '+%H:%M')
readonly URL=""

# Download the data and remove color codes

curl -s "$URL" > /tmp/corona
sed -i 's/\x1b\[[0-9;]*m//g' /tmp/corona

# Extract and display pertinent data

echo -e "\n\e[1;34mCorona (COVID-19) virus stats for $TODAY\e[0m"
echo -e "\n\e[1;33m\t\tTotal\t(New)\t\tDeaths\t(New)\tRecovered\tActive\tCritical\tCases per 1M pop\e[0m"
grep "USA" /tmp/corona | awk '{ print $2"\t\t"$4"\t("$5")\t"$7"\t("$8")\t"$10"\t\t"$11"\t"$12"\t\t"$13 }'
grep -m2 "World" /tmp/corona | tail -n1 | awk '{ print $1"\t\t"$2"\t("$3")\t"$5"\t("$6")\t"$8"\t\t"$9"\t"$10"\t\t"$11 }'
echo "Data downloaded at $NOW EDT"
echo $'\n'$"Stay safe. Stay inside. Wash your hands!"

Rick Romig
"It's never wrong to introduce a child to Linux."
Rick's Tech Stuff
It works . Thanks. Though the results are rather depressing.

Forum Jump:

Users browsing this thread: 1 Guest(s)