第2 个问题的!- @echo off
- for /f "tokens=2,4,7 delims=, " %%a in (gb.txt) do (
- set "a1=%%a" & set "a2=%%b"& set "a3=%%c"
- call :leiji
- )
- set ci=1
- :pai
- set/a b2=0
- set/a c3=0
- for /f "tokens=1,2,3" %%a in (tmpp.txt) do (
- set "a1=%%a"& set/a a2=%%b& set/a a3=%%c
- call :bijiao
- )
-
- echo/ %ci%.客户 %b1% ,累计上传%b2:~,-2%.%b2:~-2%MB,累计下载%b3:~,-2%.%b3:~-2%GB >>a.txt
- echo/ %ci%.客户 %c1% ,累计下载%c3:~,-2%.%c3:~-2%GB,累计上传%c2:~,-2%.%c2:~-2%MB >>b.txt
- set/a ci+=1
- if %ci% lss 11 goto pai
- del/q tmpp.txt
- echo 已经整理完毕!即将退出。
- ping -n 2 baidu.com >nul&exit
-
- :bijiao
- set/a a2=%a2%
- set/a a3=%a3%
- if exist a.txt (for /f "tokens=2" %%x in (a.txt) do (if %a1%==%%x goto bijiao2))
- if %b2% leq %a2% (set "b1=%a1%" & set/a b2=%a2% & set/a b3=%a3%)
-
- :bijiao2
- if exist b.txt (for /f "tokens=2" %%y in (b.txt) do (if %a1%==%%y goto :eof))
- if %c3% leq %a3% (set "c1=%a1%" & set/a c2=%a2% & set/a c3=%a3%)
- goto :eof
-
- :leiji
- if exist tmpp.txt (for /f "tokens=1" %%z in (tmpp.txt) do (if %a1%==%%z goto :eof))
- set a2=%a2:.=%
- set a3=%a3:.=%
- for /f "tokens=2,4,7 delims=, " %%d in (gb.txt) do (
- set b1=%%d& set b2=%%e& set b3=%%f
- if %a1%==%%d call :leiji2
- )
- echo %a1% %a2% %a3% >>tmpp.txt
- goto :eof
- :leiji2
- set b2=%b2:.=%
- set b3=%b3:.=%
- set/a a2+=%b2%
- set/a a3+=%b3%
- goto :eof
复制代码
|