I have multiple .csv
files in a directory called mydirectory
. I want to sort all these files using some bash/awk/sed command first based on LeftChr
column and then RightChr
column and get the result
.
>Id LeftChr LeftPosition LeftStrand LeftLength RightChr RightPosition RightStrand
1979 chr1 825881 - 252 chr2 5726723 -
5480 chr2 826313 + 444 chr2 5727501 +
5492 chr5 869527 + 698 chr2 870339 +
1980 chr2 1584550 - 263 chr1 1651034 -
5491 chr14 1685863 + 148 chr1 1686679 +
5490 chr1 1691382 + 190 chr1 1693020 +
result
>Id LeftChr LeftPosition LeftStrand LeftLength RightChr RightPosition RightStrand
5490 chr1 1691382 + 190 chr1 1693020 +
1979 chr1 825881 - 252 chr2 5726723 -
1980 chr2 1584550 - 263 chr1 1651034 -
5480 chr2 826313 + 444 chr2 5727501 +
5492 chr5 869527 + 698 chr2 870339 +
5491 chr14 1685863 + 148 chr1 1686679 +