# How to output only the overlapping region of two files?

I have two files of genomic coordinates. I am trying to output only the overlapping region of fileA if it intersects with fileB. Not the original fileA coordinates.

fileA

chr1 25 50
chr1 75 200


fileB

chr1 10 60
chr1 80 90


desired output

chr1 25 50
chr1 80 90

• Please provide a small reproducible example using dput so we can help you. All you need to do is run dput(fileA) in R and, paste the output in the terminal. Jul 9 '19 at 20:33

$cat fileA chr1 25 50 chr1 75 200$ cat fileB