SRVLIST=$(cat input.txt | tr -s ' ' | grep -o '[^ ]*$' | sort -u) for SRV in $SRVLIST; do TSTAMP=$(cat input.txt | grep $SRV | sort | tail -1 | cut -d' ' -f1) echo $SRV $TSTAMP done Eredmény: dbs01 1716491210 web99 1716483542