I need to parse a tab-delimited text file by grabbing specific columns, like columns 1 and 5, and output each of these columns into a text file. Please find an example of the data file, and the code:
Data file:
COL1 COL2 COL3 COL4 COL5 COL6
123 345 678 890 012 234
234 456 787 901 123 345
etc
Batch file:
@echo off & setlocal
For /F "tokens=1,5*" %%i in (myFile.dat) do call :doSomething "%%i" "%%j"
goto :eof
:doSomething
Set VAR1=%1
Set VAR2=%2
@echo %VAR1%>>Entity.txt
@echo %VAR2%>>Account.txt
This works, however, the For
loop stops on the first line.
Could you help me in finding the issue?