#!/bin/sh

# Aim is to print only the lines with different size & latest time.
#
# Why does the loop go in reverse order with FreeBSD awk on 12.2-RELEASE-p7,
# 13-STABLE c 20210628 ...
#
#   10:43:46   18.2T   pool
#   10:09:59   18.1T   pool
#
# ...? Loop in gawk 5.1.0 goes as expected ...
#
#   10:09:59   18.1T   pool
#   10:43:46   18.2T   pool

# FreeBSD 12, 13 awk.
awk='/usr/bin/awk'
#
# From lang/gawk 5.1.0 port; I used the package on FreeBSD 13.
#awk='/usr/local/bin/gawk'

cat <<_LINE | $awk '{ line[$2] = $0 } END { for ( i in line ) { print line[i] } }'
10:09:58   18.1T   pool
10:09:59   18.1T   pool
10:43:45   18.2T   pool
10:43:46   18.2T   pool
_LINE

