Given result.txt looks like shown bellow, this two example calculates the Upload and Download average values:
cat result.txt |grep Upload|awk '{ sum += $2 } END { if (NR > 0) print sum / NR }' cat result.txt |grep Download|awk '{ sum += $2 } END { if (NR > 0) print sum / NR }'
Tue Aug 8 16:44:15 CEST 2017 Ping: 14.859 ms Download: 444.21 Mbit/s Upload: 38.20 Mbit/s Tue Aug 8 16:44:38 CEST 2017 Ping: 14.195 ms Download: 363.48 Mbit/s Upload: 76.13 Mbit/s Tue Aug 8 16:45:00 CEST 2017 Ping: 15.078 ms Download: 244.67 Mbit/s Upload: 82.88 Mbit/s Tue Aug 8 16:45:27 CEST 2017 Ping: 14.327 ms Download: 508.94 Mbit/s Upload: 57.22 Mbit/s Tue Aug 8 16:45:50 CEST 2017 Ping: 14.84 ms Download: 529.74 Mbit/s Upload: 80.20 Mbit/s Tue Aug 8 16:46:09 CEST 2017 Ping: 14.47 ms Download: 520.76 Mbit/s Upload: 76.64 Mbit/s Tue Aug 8 16:46:29 CEST 2017 Ping: 13.952 ms Download: 442.88 Mbit/s Upload: 56.64 Mbit/s