练练手,用纯P试试:- @echo off
- cd "D:\JZ"
- set N=10
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in (a.txt) do (
- for %%j in (%%i) do (
- set /a _%%j+=1
- if !_%%j! equ !N! (
- set #%%j=true
- ) else (
- if !_%%j! gtr !N! set #%%j=
- )
- )
- )
- for /f "delims=#=" %%k in ('set #') do set str=!str! %%k
- if defined str echo,!str:~1!>b.txt
复制代码
|