Remove last line from a CSV file RRS feed

  • Question

  • I have a csv file that has a carriage return at the end of the file.  The program that I need to feed the CSV file errors out if there is that additional space.  I can edit it out manually but would like to remove it with powershell.  How can I achieve this?

    I have tried bote of the commands below but they do not seem to work.  I have also tried the trim command none then have any affect on a carriage return.

    (Get-Content $addQuota |?{ $_.Replace(",","") -ne "" })| Out-File $addQuota
    (Get-Content $addQuota |?{ $_.Replace(",","") -ne "" })| Set-Content $addQuota
    Monday, April 7, 2014 8:41 PM


All replies