cat file1 file2 | sed "s/[-:]/\t/g" | bedtools sort | bedtools merge > result
But it can only merge them. I would be thankful if I could have your kind suggestions regarding to find only common regions (without extra lengths) between two files.
If you use zsh (as some on Mac OS do), then the syntax for process substitutions is slightly different, but it's the same idea. (If you use Mac OS, though, your sed command would probably be a bit different.)
Bonus BEDOPS: One advantage is the ability to specify arbitrary numbers of processes, if you have more than two files:
Thanks to send me this information.
I have installed bedops as a "bin" file and run the command exactly in the bin directory and also another directory, but still I have these errors:
What bedtools merge command doing is merge overlap intervals, in your case, you will get union sets of bed intervals. You should use bedtools intersect to get only common regions, but you need to convert to bed format first.
Thanks to send me this information. I have installed bedops as a "bin" file and run the command exactly in the bin directory and also another directory, but still I have these errors:
Do you know what is the problem?
You either need to copy binaries to /usr/local/bin or add the directory containing binaries to your PATH environment variable.
See: https://bedops.readthedocs.io/en/latest/content/installation.html#linux