I want to run a loop command on each pair of files
a_xxx.wig
b_xxx.wig
c_xxx.wig
a_xxx.bed
b_xxx.bed
c_xxx.bed
I'd like to match the files based on sample name (a,b or c) and have the loop run a command through each of the pairs without having to do one at a time
for file in * do
bedtools intersect -a $sample.wig -b $sample > $sample.bed
done
Any ideas or pointers would be greatly appreciated