Then it works correctly and it replaces the new line.
But
If I load a file with the exact same statement into $SQL_output it does not work.
For example this code:
$q_path=“H:\xxx.txt”
$SQL_output = (Get-content $q_path)
$SQL_outputneu = ($SQL_output -replace " select *`n", " select *")
$SQL_outputneu
Get-Content splits lines on line feeds as is and creates an array of strings, one line per item. In order to disable the splitting to get the behaviour you want, you will need to add the -Raw parameter.