This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Loop bedtools command over multiple files

I need to loop through bedtools over multiple files. There are 40 files that i should perform bedtools intersect with another file on shell. This is what i gave:

for i in temp*
do
bedtools intersect -a A.bed -b $i -v
done

However, this did not work. Is there anyother way that this can be done?

software error

Try putting the -v before the -a.

1 answer

Without using a loop:

$ bedops --not-element-of 1 A.bed temp*.bed > answer.bed

Log in to answer this question.