Cómo crear una nueva tabla de actualización usando la tabla bash

Tengo problemas para crear una tabla html para mostrar estadísticas de un archivo de texto. Estoy seguro de que hay 100 formas de hacerlo mejor, pero aquí está:

#! / bin / bash

función getapistats () {
curl -s http://api.example.com/stats> api-stats.txt
awk {‘print $ 1’} api-stats.txt> api-stats-int.txt
awk {‘print $ 2’} api-stats.txt> api-stats-fqdm.txt
}

# api-stats.txt ejemplo
# 992 cdn.example.com
# 227 static.foo.com
# 225 imgcdn.bar.com
# final api-stats.txt ejemplo

función get_int () {

para i en `cat api-stats-int.txt`;
do echo -e “

$ {i}

“;
hecho
}

función get_fqdn () {

para f en `cat api-stats-fqdn.txt`;
do echo -e “

$ {f}

“;
hecho

}

función build_table () {

echo “

“;
echo -e “` get_int` “” `get_fqdn`”;
#echo -e “` get_fqdn` “;
echo “

“;
}

getapistats;

build_table> api-stats.html;

# Error de salida 😐
#

#

#

#

#

#

# Salida deseada:
#

# …

992
227
225 cdn.example.com
static.foo.com
imgcdn.bar.com
992 cdn.example.com