title: Remove last line from file with Powershell
body: <p>I am using </p>
  
  <pre><code>gc FileWithEmptyLines.txt | where {$_ -ne ""} &gt; FileWithNoEmptyLines.txt
  </code></pre>
  
  <p>to remove the empty lines that SSRS puts at the bottom of my CSVs.</p>
  
  <p>However, the last line, which has data on it, ends with a CRLF (as viewed in Notepad++) - and this is not removed, so technically there is still a blank line at the bottom of the file.</p>
  
  <p>Is there a way to remove this CRLF from the last line (and keep the data intact, of course)?</p>