本文介绍了解析制表符分隔文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要通过这些列的敛特定列,比如列1和5,输出到一个文本文件来解析制表符分隔的文本文件。请找到数据文件的一个例子,和code:
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:
数据文件:
COL1 COL2 COL3 COL4 COL5 COL6 123 345 678 890 012 234 234 456 787 901 123 345 etc批处理文件:
@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?
推荐答案您code正常工作对我来说,但也许试试这个缩短的版本?
Your code works fine for me, but maybe try this shortened version?
@echo off for /F "tokens=1,5*" %%i in (myFile.dat) do ( echo %%i >>Entity.txt echo %%j >>Account.txt )更多推荐
解析制表符分隔文本文件
发布评论