Articles

delims to through string

June 21, 2011 at 04:12:55
Specs: Windows XP

FOR /F "tokens=3 delims==}" %%A IN (snow.txt) DO @echo %%A >>test.txt
the above goes through a string and echos the third substring.
how can i get delims to continue to do this for the whole string.
{X=32,Y=62}{X=32,Y=62}{X=32,Y=63}{X=33,Y=61}
=62626361
appended to one another

See More: delims to through string

Report •


#1
June 21, 2011 at 04:18:15

before someone replys 3,6 etc this is a long string and that method is not acceptable

Report •

#2
June 21, 2011 at 07:25:09

@echo off & setlocal EnableDelayedExpansion
type nul > test.txt
for /F "delims=" %%J in (snow.txt) do (
  set line=%%J
  (set row=)
  call :PARSE
  echo.!row!>> test.txt
)
goto :EOF
 
:PARSE
for /F "tokens=1,* delims=}" %%A in ("%line%") do (
  for /F "tokens=3 delims==" %%C in ("%%A") do set row=!row!%%C
  set line=%%B
)
if defined line (goto :PARSE) else (goto :EOF)



Report •

Related Solutions


Ask Question