保存为s.bat
s ab 查找 --AB--
s ab pb 查找 --AB-- --PB--
s PB Ab c4 查找- --PB-- --AB-- --C4--
s ab 查找 --AB--
s ab pb 查找 --AB-- --PB--
s PB Ab c4 查找- --PB-- --AB-- --C4--
@echo off&setlocal enabledelayedexpansion
set KWF="a.txt"
del $$.tmp $$$.tmp>nul 2>nul
:while
if "%~1" equ "" goto:a
ECHO %1
echo %~1>>$$.tmp
shift /1
goto:while
:a
for /r %%i in (*.txt) do (set n=1& if /i "%%~nxi" neq %KWF% call:CONVERT "%%~i")
del $$.tmp $$$.tmp&pause&goto:eof
:CONVERT
set/a tp=0
for /f "usebackq delims=" %%i in ("%~1") do (
set lb6=%%i
set lb6=!lb6:~0,6!
echo %%i>>$$$.tmp
for /f %%a in ($$.tmp) do if /i "!lb6!" equ "--%%a--" (echo %%i|findstr /g:%KWF%>NUL&&set/a tp=1)
if "!lb6!" equ "--LP--" (
if "!tp!" equ "1" (
echo 文件 "%~nx1" 第 !n! 段,符合要求……
type $$$.tmp>>$dest$.txt
set/a tp=0
type nul>$$$.tmp
)
set /a n+=1
)
)
GOTO:EOF
本帖最近评分记录
(共 1 条)
点击查看详情
| 评分人 | 分数 | 时间 |
|---|---|---|
| lxh623 | +2 | 2009-04-26 13:17 |

