text: user4211: I got the following error when attempting to intersect two files. The file below is supposed to be the -a file.
  Error: Unable to open file compare_me_to.txt. Exiting.
  
  When I attempted to make it tab-delimited through Ubuntu (see code below)
  perl -p -i -e 's/ /\t/g' compare_me_to.txt
  
  I got the following error:
  Can't open compare_me_to: Permission denied.
  
  Additionally, the ownership of the folder the files are in is of my username.
  I can't tell if this is a bedtools problem or a Ubuntu problem or something else.
  
  user3848: I suspect the reason is the "-i". The following will work,
  perl -pe 's/  */\t/g' compare_me_to.txt > compare_me_to.txt2
  
  -i will want to write onto the file and create a backup. I suspect you'll have spotted chmod +w compare_me_to.txt.
  Just make sure that a double space is inserted before the * character, otherwise it will go wrong. Copying and pasting will avoid this.
  
  This is a clearer solution because it avoids missing a space character,
  perl -e 's/[ ][ ]*/\t/g' compare_me_to.txt > compare_me_to.txt2
  
  and the solution you used .. (I did on OS X), what I'd recommend is,
  perl -p -e 's/[ ][ ]*/\t/g' compare_me_to.txt # to see if it works by printing on screen without altering the file
  
  perl -i -e 's/[ ][ ]*/\t/g' compare_me_to.txt
  
  The  -i flag will alter the original file and store a backup without requiring renaming the file.
  What's it doing?
  The regex [ ][ ]* structure is saying look a space and if one or more spaces occur adjacent to each other replace everything with a single tab. [ ]* means a "space" that is present or absent and if present it can be present an infinite number of times. If the [ ]* is by itself the command risks saying replace '' (zip) or 'space' with a tab, so tabs can appear at every '' (zilch), so tabs can appear everywhere. The "*" symbol in regex work differently to the "*" wildcard character in shell.
  
original_text: 4211: <p>I got the following error when attempting to intersect two files. The file below is supposed to be the -a file.</p>
  
  <pre><code>Error: Unable to open file compare_me_to.txt. Exiting.
  </code></pre>
  
  <p>When I attempted to make it tab-delimited through Ubuntu (see code below)</p>
  
  <pre><code>perl -p -i -e 's/ /\t/g' compare_me_to.txt
  </code></pre>
  
  <p>I got the following error:</p>
  
  <pre><code>Can't open compare_me_to: Permission denied.
  </code></pre>
  
  <p>Additionally, the ownership of the folder the files are in is of my username.
  I can't tell if this is a bedtools problem or a Ubuntu problem or something else.</p>
   3848: <p>I suspect the reason is the "-i". The following will work,</p>
  
  <pre><code>perl -pe 's/  */\t/g' compare_me_to.txt &gt; compare_me_to.txt2
  </code></pre>
  
  <p>-i will want to write onto the file and create a backup. I suspect you'll have spotted <code>chmod +w compare_me_to.txt</code>.</p>
  
  <p>Just make sure that a double space is inserted before the * character, otherwise it will go wrong. Copying and pasting will avoid this.</p>
  
  <hr>
  
  <p>This is a clearer solution because it avoids missing a space character,</p>
  
  <pre><code>perl -e 's/[ ][ ]*/\t/g' compare_me_to.txt &gt; compare_me_to.txt2
  </code></pre>
  
  <p>and the solution you used .. (I did on OS X), what I'd recommend is,</p>
  
  <pre><code>perl -p -e 's/[ ][ ]*/\t/g' compare_me_to.txt # to see if it works by printing on screen without altering the file
  
  perl -i -e 's/[ ][ ]*/\t/g' compare_me_to.txt
  </code></pre>
  
  <p>The  -i flag will alter the original file and store a backup without requiring renaming the file.</p>
  
  <p><strong>What's it doing?</strong>
  The regex [ ][ ]* structure is saying look a space and if one or more spaces occur adjacent to each other replace everything with a single tab. [ ]* means a "space" that is present or absent and if present it can be present an infinite number of times. If the [ ]* is by itself the command risks saying replace '' (zip) or 'space' with a tab, so tabs can appear at every '' (zilch), so tabs can appear everywhere. The "*" symbol in regex work differently to the "*" wildcard character in shell.</p>
  