awk print line with highest value

grepping on a value but then want to print only those lines that have the highest value in the 4th column

log text text R59FJ
log text text R63FT
log text text R60JX
log1 text text R63EA
log1 text text R60JX 

desired output

log text text R63FT
log1 text text R63EA

tried this but not getting the right output. Any help would be appreciated.

awk '!a[$4]++ && l {print l} {l=$0}; END {print l}'
awk '$4 > a[$1] {a[$1]=$4; b[$1]=$0}; END {for (i in b) print b}' infile
1 Like

Although not mentioning it, neither in the specification nor in the sample code, your desired output implies you want the "maximum" per $1 value.
Are you talking of $4's entire string value, or of the numerical part only? What if it starts with an "S" or an "s"?
If you go for the numerical part, try

awk '{T = $4; gsub (/[^0-9]/, "", T); if (T > a[$1]) {a[$1]=T; b[$1]=$0}}; END {for (i in b) print b}' file