纯P方法:- @echo off
- (for /f %%i in (lit.txt) do (
- for /f %%j in ('type test.txt ^| find "%%i" /c') do (
- echo %%i有%%j次
- )
- )) >jjpc.txt
- pause
复制代码 用gawk:- gawk 'FILENAME=="test.txt" {a[$0]++} FILENAME=="lit.txt"{printf("%s有%d次\n",$0,a[$0])}' test.txt lit.txt >jjpc.txt
复制代码
|