回复 4# shniutan
加上顶楼的限定条件“所有文件中infoid被同一用户访问超过2次的记录”,总次数应当是17次:- @echo off
- setlocal enabledelayedexpansion
- for /f "tokens=8,12 delims=-&= " %%i in (b.txt) do set #%%j=%%i
- (for /f "tokens=1* delims==" %%x in (a.txt) do echo,%%y)>1.log
- findstr /g:1.log c.txt>Newfile.txt
- (for /f "tokens=8,9,11 delims=-= " %%a in (Newfile.txt) do (
- set /a "_%%a%%b+=1"
- set /a "_%%a%%b%%c+=1"
- if "!_%%a%%b!" == "2" echo,%%a-%%b
- ))>1.log
- findstr /g:1.log Newfile.txt>2.log
- (for /f "tokens=8,9,11 delims=-= " %%a in (2.log) do (
- if not defined @%%a%%b%%c (
- echo,%%c !#%%c! %%a-%%b !_%%a%%b%%c!
- set /a Sum+=!_%%a%%b%%c!
- )
- set @%%a%%b%%c=true
- ))>1.log
- sort 1.log>Newfile.txt
- echo,Sum !Sum!>>Newfile.txt
- del *.log
- pause
复制代码
|