I found a find-and-replace text answer from another question.
How do I use PowerShell to remove extra spaces at end of line in a text file?
There are a number of approaches but this one is pretty simple:
$content = Get-Content file.txt
$content | Foreach {$_.TrimEnd()} | Set-Content file.txt
You may need to tweak the Encoding
parameter on the Set-Content cmdlet to get the file output in the encoding you want (Unicode, ASCII, UTF8, etc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With