Search found 4 matches

by brentonv
13 Jun 2020 06:06
Forum: DOS Batch Forum
Topic: Is there a way to split a string to new lines in file by delimiter
Replies: 4
Views: 6952

Re: Is there a way to split a string to new lines in file by delimiter

Stephan from SO worked out this code for me and it handles all special characters https://stackoverflow.com/a/62320627/13515739 Posting here for anyone else looking for a solution to this. @echo off setlocal enabledelayedexpansion set /p string=<"input.txt" set "string=%string: =@%" set "string="%st...
by brentonv
12 Jun 2020 22:23
Forum: DOS Batch Forum
Topic: Is there a way to split a string to new lines in file by delimiter
Replies: 4
Views: 6952

Re: Is there a way to split a string to new lines in file by delimiter

Actually I'm pretty sure I tried it when I first came across that SO post. I tested it again and using my example it only pulls the first token. Thanks anyway.
by brentonv
11 Jun 2020 09:40
Forum: DOS Batch Forum
Topic: Is there a way to split a string to new lines in file by delimiter
Replies: 4
Views: 6952

Re: Is there a way to split a string to new lines in file by delimiter

Thanks Jeb, I'll try it tomorrow and let you know how it goes :D
by brentonv
11 Jun 2020 00:26
Forum: DOS Batch Forum
Topic: Is there a way to split a string to new lines in file by delimiter
Replies: 4
Views: 6952

Is there a way to split a string to new lines in file by delimiter

In batch I'm trying to split a string into substrings preferably based on a delimiter. This example works but is there a better way to do this: for /f "tokens=1-20 delims=:" %%a in (string.txt) do ( echo %%a& echo.%%b& echo.%%c& echo.%%d& echo.%%e& echo.%%f& echo.%%g& echo.%%h& echo.%%i& echo.%%j ec...