title: Powershell replace adding an empty line
body: <p>I have this powershell code which should replace every occurrence of a string in every file in the directory with a new string.
  This works, however an empty line is added in the end.
  What causes this, and how can this be nicely avoided?</p>
  
  <pre><code>$files = Get-ChildItem $currentDir *.* -recurse
  foreach ($file in $files)
      {
      $find = "placeholder"
      $replace = "newvalue"
      $content = Get-Content $($file.FullName) -Raw
      $content -replace $find,$replace | Out-File $($file.FullName) 
      }
  </code></pre>
  
  <p>Simply removing the last line is not a good solution since sometimes my files will contain an empty line which I want to keep.</p>