title: In PowerShell how to replace carriage return
body: <p>In a PowerShell script I'm exporting data read from a SQL Server query into a .csv file tab delimited. I need to remove any carriage return characters.</p>
  
  <p><code>-replace '`r`n'</code> isn't working.  I think the character is <code>char(13)</code>.</p>
  
  <p>Here's my code line that doesn't work: </p>
  
  <pre><code>(Get-Content $MyCSV_DOR) | % {$_ -replace '`r`n', " "} | out-file -FilePath $MyCSV_DOR -Force -Encoding ascii
  </code></pre>
  
  <p>I've also tried the below:</p>
  
  <pre><code>`r, `n, \r, \n and \r\n
  </code></pre>
  
  <p>All of them fail to remove the character. I've also looked at the suggested other posts. </p>
  
  <p>Are there any suggestions?</p>