标签:
贴出 批处理 代码:
@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