With GNU sort and GNU split, you can do
split -l 20 file.txt --filter "sort -knk 4|tail -n 1" The file gets splitted in packets of 20 lines, then the filter option filters each packet by the given commands, so they get sorted numerically by the 4th key and only the last line (highest value) extracted by tail.