首页 > 其他 > 详细

批处理 获取某个文件的,特定 两列,可以修改用来做相关的操作

时间:2016-07-22 19:01:22      阅读:248      评论:0      收藏:0      [点我收藏+]

贴出 批处理 代码:

 

@echo off & cls

title The batch file is in order to locate specified row and column By Frank V1.1
color 1f
mode con cols=115 lines=25
rem 设置变量延迟
setlocal enabledelayedexpansion

rem 输入参数模块
set /p fieldDelim=Please enter field delimeters:
set /p fileName=Please enter the file(qulified name) which you want:
set /p specifiedColumnOrder=Please enter the specified column1 number you want to take:
set /p specifiedColumnOrder2=Please enter the specified column2 number you want to take:
set /p readOutputFileName=Please enter the output file qulified name


rem 接收传入参数模块
set fieldDel=!fieldDelim!
set /a specifiedColumnOrd=%specifiedColumnOrder%
set /a specifiedColumnOrd2=%specifiedColumnOrder2%
set fileNam=!fileName!
set readOutputFile=!readOutputFileName!


::读取第一行表头的俩 field 以及 指定行的 俩 field ,提示 Missing Operator 的问题没找到原因
for /f "delims=^%fieldDel% tokens=%specifiedColumnOrd%,%specifiedColumnOrd2%" %%i in (%fileNam%) do echo ^%fieldDel%%%i^%fieldDel%^%fieldDel%%%j^%fieldDel%>>%readOutputFile%

type %readOutputFile%
pause>nul

批处理 获取某个文件的,特定 两列,可以修改用来做相关的操作

原文:http://www.cnblogs.com/Frank99/p/5695926.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!