解析制表符分隔文本文件

编程入门 行业动态 更新时间:2024-10-28 20:29:22
本文介绍了解析制表符分隔文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要通过这些列的敛特定列,比如列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 )

更多推荐

解析制表符分隔文本文件

本文发布于:2023-10-26 00:55:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1528615.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:制表符   文本文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!