text: user8543: I am trying to merge two bed files (more in future) to one. my bed files are something like : 
  .
  I need to merge them in a way to have the shared chromosome location. 
  Is there a way to do that ?
  
  user776: 
  Convert each of your Excel spreadsheets to tab-delimited text files (how-to).
  Install and run Cygwin, if using Windows. If you are using OS X, open up the Terminal app.
  Install the BEDOPS toolkit to get sorting and set operation tools (if you're not averse to using them).
  Strip out the Microsoft line endings, strip the header, and sort each of the N files:
  $ tr -d '\r' < fileN.tsv | tail -n+2 - | sort-bed - > fileN.bed
  
  Merge the files:
  $ bedops --merge file1.bed file2.bed ... fileN.bed > answer.bed
  
  
  The file answer.bed will contain all merged regions from files file1.bed through fileN.bed. Merging will be done on intervals for each unique chromosome name.
  
  user4766: In my opinion, the easiest way to merge bed files is to use bedtools merge.
  
original_text: 8543: <p>I am trying to merge two bed files (more in future) to one. my bed files are something like : 
  <a href="https://i.stack.imgur.com/dcAAi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dcAAi.png" alt="result of macs pea calling"></a>.</p>
  
  <p>I need to merge them in a way to have the shared chromosome location. </p>
  
  <p>Is there a way to do that ?</p>
   776: <ol>
  <li>Convert each of your Excel spreadsheets to tab-delimited text files (<a href="https://www.howtogeek.com/79991/convert-an-excel-spreadsheet-to-a-tab-delimited-text-file/" rel="nofollow noreferrer">how-to</a>).</li>
  <li><a href="https://cygwin.com/install.html" rel="nofollow noreferrer">Install and run Cygwin</a>, if using Windows. If you are using OS X, open up the Terminal app.</li>
  <li><a href="https://bedops.readthedocs.io/en/latest/content/installation.html" rel="nofollow noreferrer">Install the BEDOPS toolkit</a> to get sorting and set operation tools (if you're not averse to using them).</li>
  <li><p>Strip out the Microsoft line endings, strip the header, and sort each of the <em>N</em> files:</p>
  
  <pre><code>$ tr -d '\r' &lt; fileN.tsv | tail -n+2 - | sort-bed - &gt; fileN.bed
  </code></pre></li>
  <li><p>Merge the files:</p>
  
  <pre><code>$ bedops --merge file1.bed file2.bed ... fileN.bed &gt; answer.bed
  </code></pre></li>
  </ol>
  
  <p>The file <code>answer.bed</code> will contain all merged regions from files <code>file1.bed</code> through <code>fileN.bed</code>. Merging will be done on intervals for each unique chromosome name.</p>
   4766: <p>In my opinion, the easiest way to merge bed files is to use <code>bedtools merge</code>.</p>
  