I expect GNU sort does quite a bit, including handling data sets that don't fit into memory.
Anyway, this post is about regexes, which really has nothing at all to do with sorting. They are two very different problems. :)