按电话区号分组排列手机区段:- @echo off&setlocal enabledelayedexpansion
- for /f "tokens=1,2" %%a in (data.txt) do (if not "%%b"=="!b!" set @%%b@%%a=a
- echo.正在预处理%%a %%b&set b=%%b)
- echo.正在进行后期处理...
- for /f "tokens=1,2" %%a in (quhao.txt) do set @%%b#%%a=b
- (for /f "tokens=2,3 delims==@#" %%a in ('set @') do if %%b==b (set a=%%a) else echo.%%a !a!)>结果.txt
- echo.已经完成&pause
复制代码 如果想加快处理速度,不看到处理过程,则:- @echo off&setlocal enabledelayedexpansion&echo.正在处理中。。。
- for /f "tokens=1,2" %%a in (data.txt) do (if not "%%b"=="!b!" set @%%b@%%a=a
- set b=%%b)
- for /f "tokens=1,2" %%a in (quhao.txt) do set @%%b#%%a=b
- (for /f "tokens=2,3 delims==@#" %%a in ('set @') do if %%b==b (set a=%%a) else echo.%%a !a!)>结果.txt
复制代码
[ 本帖最后由 hanyeguxing 于 2010-5-5 17:47 编辑 ] |