本帖最后由 terse 于 2011-4-19 11:24 编辑
没测试
简化下计算
另跳格键 需自己改- @echo off&setlocal enabledelayedexpansion
- ::这里跳格键
- set "Tab= "
- set /p str=<char.txt>nul
- >char.xls echo !str!
- set "A区=候国强 毛远锋 易湛慧 李楠 池茜"
- set "B区=王冬 刘通 文娟娟 马宇芊"
- for %%i in (A区 B区) do for %%j in (!%%i!) do set %%j=%%i&>%%j.txt echo !str!
- for /f "skip=1 tokens=1-4" %%a in (char.txt) do (
- if /i "!%%d!" equ "%%a" if !_%%d! lss 150 (
- set /a _%%d+=1
- >>%%d.txt echo;%%a%Tab%%%b%Tab%%%c%Tab%%%d
- set "%%a%Tab%%%b%Tab%%%c%Tab%%%d=a"
- for /f "tokens=1,2 delims=." %%i in ("%%c") do (
- set d=%%j000
- set/a #%%d+=%%i!d:~,3!"
- )
- ) else set %%d=&2>nul move %%d.txt "%%d_!#%%d:~,-3!.!#%%d:~-3!.xls"
- )
- for %%i in (A区 B区) do for %%j in (!%%i!) do if not defined %%j set %%i=!%%i:%%j=!
- for /f "skip=1 tokens=1-4" %%a in (char.txt) do (
- if "!%%a%Tab%%%b%Tab%%%c%Tab%%%d!" equ "" (
- for %%i in (!%%a!) do set name=%%~i
- for %%e in (!name!) do if !_%%e! lss 150 (
- set /a _%%e+=1
- >>%%e.txt echo;%%a%Tab%%%b%Tab%%%c%Tab%%%d
- for /f "tokens=1,2 delims=." %%i in ("%%c") do (
- set d=%%j000
- set/a "#%%e+=%%i!d:~,3!"
- )
- ) else set %%a=!%%a:%%e=!&set name=&2>nul move %%e.txt "%%e_!#%%e:~,-3!.!#%%e:~-3!.xls"
- if not defined name >>char.xls echo;%%a%Tab%%%b%Tab%%%c%Tab%%%d
- )
- )
- pause
复制代码
|