I am sorting a file prior to joining it with another file, using
sort -k1 file1 > file1_sort
When I try to join with the second file, I get an error saying file1 is not sorted. I think this is occurring because of the following entry:
chr6_32609371_I I2 D
chr6_32609371 T C
The "chr6_32609371" line needs to be placed before the "chr6_32609371_I" in my sorted file. Is there an argument I can add to the sort command to get this to happen?
sort -k1,1
to sort on the first column.-b
may also be needed. – Stéphane Chazelas Oct 29 '14 at 15:06sort
invocations have the same locale. See: http://unix.stackexchange.com/questions/12942/join-file-2-not-in-sorted-order – Oct 29 '14 at 15:18