in reply to Sample Sort Code

consider just using (unix command line) sort (also freely available for Windows):
sort -k1,2 -k5 file_in.txt >file_out.txt