I have an long string in a text file as below:
"12345", "23456-1w3s", "abas-122", "9876-ads", "alfsajf;lda"
Now my task is to separate it into multiple lines based on the quotation in an another text file as below:
"12345"
"23456-1w3s"
"abas-122"
"9876-ads"
"alfsajf;lda"
I tired as be low code, but I found that there is no consistency and the output depend on the substring itself
Code: Select all
for /f "tokens=1-5 delims=," %%A in (fdata1.txt) do call :EachLine %%A %%B %%C %%D %%E
:EachLine
set a=%1
set b=%2
set c=%3
set d=%4
set e=%5
ECHO %d%>>echo_data_1.txt
ECHO %c%>>echo_data_1.txt
ECHO %a%>>echo_data_1.txt
ECHO %b%>>echo_data_1.txt
ECHO %e%>>echo_data_1.txt
"9876-ads"
"23456-1w3s"
"12345"
"abas-122"
"alfsajf;lda"
but sometimes it output as below:
ECHO is off.
ECHO is off.
"12345"
"abas-122"
ECHO is off.
looks like up to the substring itself, length...or complicated...?
Is any better way to process this kind of task as above?
Thanks