Hi, I have a A.bed file only with the gene name of these
chr1-1
chr1-10
chr1-102
chr1-106
chr1-11
chr1-2
chr1-3
and I know they also in one column of B.bed .
chr1 startpos endpos chr1-1
chr1 startpos endpos chr1-10
chr1 startpos endpos chr1-102
chr1 startpos endpos chr1-106
chr1 startpos endpos chr1-11
chr1 startpos endpos chr1-2
chr1 startpos endpos chr1-3
chr2 startpos endpos chr2-234
chr12 startpos endpos chr12-23546
However, why
cut -f4 B.bed > C.bed # only use the gene name column
comm -1 -2 A.bed C.bed
find all of them, But
grep -w -f A.bed B.bed
only find
chr1-1
chr1-2
chr1-3
Because comm cannot show whole rows in B.bed.
How could I use grep to call all the matched rows in B.bed?
Or how could I call all the rows in B.bed file with matched words of one column using another file?
Are the A and C files sorted?
yes sorte have sorted, comm is right, grep cannot get right number
Sorry, should have read it better. Are there special characters in one of the files?
Have you tried the join command?