I have the next batch file:
@echo off
setlocal enabledelayedexpansion
set lastpart=
for /F "tokens=2 delims=," %%f in (test.csv) do (
set lastPart= %%f
echo !lastPart!
pause
)
And the test.csv:
a1,,a3,,a5
b1,b2,b3,b4,b5
,,c3,,
,d2,,d4,
,,,,
My real output is: a3,b2,d2. Output I need: empty, b2, empty, d2, empty. The problem is that de loop not read empty tokens. Is there a property or something so the loop not avoid empty tokens? The loop always must have 5 tokens per line
Thanks