I have a text file and I want to remove the last line break inside this file:
Text
with the following regex in Powershell:
(Get-Content .\test.txt -Raw) -replace ('\r\n(?=$)', '') | Set-Content .\test.txt
but this is not working.
I have the tried the regex-pattern: \r\n(?=$) to be replaced by '' in Notepad++ and Java and there it's working.
How can I get this to be working in Powershell?