I have about 300 files I need to parse which are tab delimited. The code I'm using below (not finished) is:
for /r C:\mywork2\MAX\ %%f in (*) do (
for /f "delims=TAB" %%i in (%%f) do (
for %%u in (%%i) do (
ECHO %%u
)
)
pause
)
It appears to work fine, except whenever a field begins with a T, A or B the ECHO removes this character? i.e., Taxidea_taxus becomes axidea_taxus. Is this a bug, or can I work around it? I should note that using <TAB> produces the same effect.
When you specify delims=TAB, the processor uses, literally T, A, and B as delimiters. To use a Tab character, you have enter a literal tab (which will show as whitespace in the script).
Try this:
REM Set a variable to the <TAB> character.
REM Make sure you editor doesn't replace Tabs with spaces.
REM Enter an actual <tab> in the SET statement below.
SET "TabChar= "
for /r C:\mywork2\MAX\ %%f in (*) do (
REM Parse with the tab character.
for /f "delims=%TabChar%" %%i in (%%f) do (
for %%u in (%%i) do (
ECHO %%u
)
)
pause
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With