Intersect two files regarding the sequences' strand and save the result to the specified file

bedtools

  • A swiss-army knife of tools for genomic-analysis tasks.
    Used to intersect, group, convert and count data in BAM, BED, GFF/GTF, VCF format.
    More information: <https://bedtools.readthedocs.io>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

bedtools intersect -a {{path/to/file_1}} -b {{path/to/file_2}} -s > {{path/to/output_file}}

click the source code to copy install bedtools on any operating system with command-not-found.com