awk -F " " '($1=="A1") {print $NF}' FILE | tail -n 1
Use awk
with field separator -F set to a space " ".
Use the pattern $1=="A1"
and action {print $NF}
, this will print the last field in every record where the first field is "A1". Pipe the result into tail and use the -n 1
option to only show the last line.