I have multiple data that in all of them the first 3rd columns are the same and I like to merge those data based on these three columns. I can do it with merge command in R but I like to do it in Linux (I used joint command but it does not work well).
data1:
chr1 724060 724400 SK chr1 724206 725561 peak_1 24 . 2 194
chr1 729399 731900 sun . -1 -1 . . . . 0
data2:
chr1 724060 724400 sk . -1 -1 . . . . 0
chr1 729399 731900 sun chr1 724206 725561 peak_10 24 . 5 104
output:
chr1 724060 724400 SK chr1 724206 725561 peak_1 24 . 2 194 . -1 -1 . . . . 0
chr1 729399 731900 sun . -1 -1 . . . . 0 chr1 724206 725561 peak_10 24 . 5 104
Include exact
join
command you have tried.Just I did , join data1.bed data2.bed > data.bed
For
join
to work, the files must be sorted (in the same order), and you have to tell join whichfield
you want it to do the joining by.