The sort –key
Trick
Commandline folklore: sorting files by filename or content before compression can save large amounts of space by exposing redundancy to the compressor. Examples and comparisons of different sorts.
Source: The sort --key Trick, an article by Gwern Branwen.