#!/bin/bash

# fluxTSA ... daily flux of passengers thru US airports
#
# output to the screen
# date flux_2020 flux_2019
#BUG: loads only pages 0,1,2

URL="https://www.tsa.gov/coronavirus/passenger-throughput?page="


echo -e "Day/MM \t\t2019\t 2020\t   2021" 
for i in {0..2}; do
   curl -s "$URL"$i | \
   awk -F">" '/tbody/,/\/tbody/{print $2}' | \
   sed 's/<.*$//;/^ *$/d' | \
   gsed -n '${H;g;s/\n//gp};1{H;b;};/\//{x;s/\n//gp;s/.*//;x;};H;' | \
   awk '{print $1,$4,$3,$2}'| column -t
done