I need to reorder a set of fields before writing them into a file; for this, I'm using the following FOR /F loop:
Code: Select all
for /f "tokens=1,7,4,5,6,9,11,10,15,8,26,34,52,28,27 delims=," %%A in (%input%) do (
echo.%%A,%%B,%%C,%%D,%%E,%%F,%%G,%%H,%%I,%%J,%%K,%%L,%%M,%%N,%%O>>%report%
)
But, for a reason I can't seem to be able to grasp, the output looks like this:
12004,0,WIN_S_SMH_AF18,daily_incr,frrmsmh-fp02,frrmsmh-fp02,1427043600,0000000881,1427044481,16141036,frrmsmh-fp02,2,2,%N,%O
I made sure there's no empty token in input file; I tried to reverse the ordering logic in the following way:
Code: Select all
for /f "tokens=1,4-11,15,26-28,34,52 delims=," %%A in (%input%) do (
echo.%%A,%%E,%%B,,%%C,%%D,%%G,%%I,%%H,%%J,%%F,%%K,%%N,%%O,%%M,%%L>>%report%
)
But all I get is a %N,%O in between other fields.
Is there a limitation I missed, forbidding me to have more than 13 tokens? Am I missing something? How can I make it work?
Many thanks for your help!