Problem:
Sort this data using first and second column.
Introduction:
If we use only #sort command (sort [file]):
We need to sort with both columns (sort -k1,1 -k2,2n [file])
"Sort from first column to first column with default method and then, sort from second column to second columns with numeric order"
Sort this data using first and second column.
chr10 10010946
chr1 10010947
chr1 10010948
chr1 10010949
chr1 10010950
chr1 10110951
chr10 10010952
chr10 10010953
chr10 10010954
chr10 10010955
chr10 10010956
chr10 10010957
chr10 10010941
chr10 1001942
chr10 1001943
chr10 1001944
chr10 1001945
chr10 1001958
chr10 1001959
chr10 10010960
chr10 10010961
chr10 10010962
chr10 10010963
chr10 10010964
chr10 10010965
chr10 10010966
chr10 10010967
chr10 10010968
Introduction:
If we use only #sort command (sort [file]):
chr10 10010941If we use #sort with the second column as a number (sort -k2n [file]):
chr10 10010946
chr10 10010952
chr10 10010953
chr10 10010954
chr10 10010955
chr10 10010956
chr10 10010957
chr10 10010960
chr10 10010961
chr10 10010962
chr10 10010963
chr10 10010964
chr10 10010965
chr10 10010966
chr10 10010967
chr10 10010968
chr10 1001942
chr10 1001943
chr10 1001944
chr10 1001945
chr10 1001958
chr10 1001959
chr1 10010947
chr1 10010948
chr1 10010949
chr1 10010950
chr1 10110951
chr10 1001942Solution:
chr10 1001943
chr10 1001944
chr10 1001945
chr10 1001958
chr10 1001959
chr10 10010941
chr10 10010946
chr1 10010947
chr1 10010948
chr1 10010949
chr1 10010950
chr10 10010952
chr10 10010953
chr10 10010954
chr10 10010955
chr10 10010956
chr10 10010957
chr10 10010960
chr10 10010961
chr10 10010962
chr10 10010963
chr10 10010964
chr10 10010965
chr10 10010966
chr10 10010967
chr10 10010968
chr1 10110951
We need to sort with both columns (sort -k1,1 -k2,2n [file])
"Sort from first column to first column with default method and then, sort from second column to second columns with numeric order"
chr1 10010947
chr1 10010948
chr1 10010949
chr1 10010950
chr1 10110951
chr10 1001942
chr10 1001943
chr10 1001944
chr10 1001945
chr10 1001958
chr10 1001959
chr10 10010941
chr10 10010946
chr10 10010952
chr10 10010953
chr10 10010954
chr10 10010955
chr10 10010956
chr10 10010957
chr10 10010960
chr10 10010961
chr10 10010962
chr10 10010963
chr10 10010964
chr10 10010965
chr10 10010966
chr10 10010967
chr10 10010968
No comments:
Post a Comment