I have used awk command to extract maximum value from the dummy file.
cat dummy_file
Cat Felix 3
Cat Garfield 2
Cat Tom 1
Dog Snoopy 5
Dog Spike 4
awk '{max[$1] =!($1 in max) ? $3 : ($3 > max[$1]) ? $3 : max[$1]} \
END {for (i in max) print i,max[i]}' dummy_file
Cat 3
Dog 5
Additionally to extracted maximum value and arrays element I need corresponding $2. For the output like this:
Cat Felix 3
Dog Snoopy 5
My question is - how to print wanted field after selecting arrays element?