Source file: rs1009150173,100202244031 rs1009150172,13853975996 rs1009150170,54321425962 rs1009150171,11378896079 rs1009150,171582090052
Ubuntu 20.04.5: sort -t ',' /path/to/rs_srt_exp.txt rs1009150,171582090052 rs1009150170,54321425962 rs1009150171,11378896079 rs1009150172,13853975996 rs1009150173,100202244031 (correct order) elementary OS 7 (Ubuntu 22.04.3): sort -t ',' /path/to/rs_srt_exp.txt rs1009150170,54321425962 rs1009150171,11378896079 rs1009150,171582090052 rs1009150172,13853975996 rs1009150173,100202244031 (wrong order) Python 3.10.12: with open('/path/to/rs_srt_exp.txt') as src_file_opened: for elem in sorted(map(lambda line: line.rstrip().split(','), src_file_opened)): print(elem) ['rs1009150', '171582090052'] ['rs1009150170', '54321425962'] ['rs1009150171', '11378896079'] ['rs1009150172', '13853975996'] ['rs1009150173', '100202244031'] (correct order)