2
How is it possible to run a file . bat that runs powershell to replace spaces with a new line?
I currently have this scenario in the file run.bat:
set id=1
powershell "(gc %id%_01.txt) -replace '[a-zA-Z]','' | Out-File -encoding ASCII %id%_01.txt"
And this content in the file 1_01.txt
Nome Qualquer
15000 qualquer 14999
The desired result is
15000
14999
I tried to modify the command based on some examples I saw.
powershell "(gc %id%_01.txt) -replace '[a-zA-Z]','' -replace ' ','`r`n' | Out-File -encoding ASCII %id%_01.txt"
But the way out is wrong:
`r`n
15000`r`n`r`n14999
thanks, also worked out this way -replace ' ',"
r
n"– Wesley