Script em lote para substituir a vírgula por CRLF
Se este é um lote suficiente para você, dê uma chance, pois parece ser simples e funciona. . .
The below batch script will essentially:
- Use Get-Content and Replace for the string to search (
,) and replace (CRLF)- Then it will use Set-Content to put the newly replaced string back into the file accordingly
Observação: O valor set textFile= deve ser o caminho explícito completo para o arquivo de texto. Você alterará as vírgulas para CRLF (por exemplo, C\Folder\Path\USERS.txt ) ou então se este script está na mesma pasta desse arquivo, o valor de set textFile= deve ser prefixado com %~dp0 (por exemplo, %~dp0USERS.txt )
@echo on
set search=,
set textFile=C:\Folder\Path\USERS.txt
::set textFile=%~dp0USERS.txt
:PowerShell
SET PSScript=%temp%\~tmpStrRplc.ps1
ECHO (Get-Content "%textFile%").replace("%search%", "'r'n") ^| Set-Content "%textFile%">"%PSScript%"
SET PowerShellDir=C:\Windows\System32\WindowsPowerShell\v1.0
CD /D "%PowerShellDir%"
Powershell -ExecutionPolicy Bypass -Command "& '%PSScript%'"
EXIT
Conteúdo original do arquivo
123,234,987,877,356
Conteúdo do arquivo de resultados
123
234
987
877
356