- @echo off&setlocal enabledelayedexpansion
- ::将下面的[tab]改为实际的跳格键
- set "tab=[tab]"
- for /f "delims=" %%a in (a.txt) do (
- set "str=%%a"
- for /l %%b in (1 1 50) do (
- for /f "delims=%tab%" %%c in ("!str!") do set "_%%b=!_%%b!批%%c"&set "str=!str:*%tab%=!"
- )
- )
- echo,相同的列有:
- set n=
- for /f "tokens=1* delims==" %%h in ('set _') do (
- if "!%%i!"=="" set/a n+=1&set "#!n!=%%i"
- set "%%i=!%%i!%%h"
- )
-
- for /l %%j in (1 1 %n%) do (
- set num=!#%%j!
- call,set value=%%!num!%%
- for /f "tokens=1-3 delims=_" %%x in ("!value!") do if not "%%y"=="" echo,第%%x %%y %%z列,内容为:!num:批= !
- )
- pause>nul
复制代码 效率不高,见谅。
[ 本帖最后由 weichenxiehou 于 2011-3-10 22:25 编辑 ] |