set "cut="要去除的串列表" "注意:" "用空格隔开," "和用双引号引起来""
set file=lent.txt
::out!file!为输出文件
cd.>out!file!
::读取文本,丢掉空行
for /f "tokens=*" %%a in ('type !file!') do (
cls
echo.&echo.&echo.&set /p =正在处理请稍候.<nul
set "str=%%a"
call :sub
)
echo.完成.. &type out!file!
pause
goto :eof
::丢掉纯半角行和半角字符多或等于20的行
:sub
call :getlen2 strlen0
set str=!str:"=""!
call :getlen2 strlen2
for /f "skip=1 delims=:" %%a in ('^(echo "!str!"^&echo.^)^|findstr /o ".*"') do set/a strlen1=%%a-5
if !strlen1!==!strlen2! goto :eof
set /a m=strlen2*3-strlen1-strlen0
if !m! gtr 19 goto :eof
::**********************************
::清除特定词组
for %%a in (!cut!) do set "str=!str:%%~a=!"
::************
set /p =..<nul
::4个空格变回车换行
set "str=!str:2=22!"
set "str=!str: =020!"
set "str=!str: =a2a!"
set "str="!str:020=" "!""
for /f "tokens=1-8" %%b in ('echo !str!') do call :ret %%b&call :ret %%c&call :ret %%d&call :ret %%e&call :ret%%f &call :ret %%g&call :ret %%h&call :ret %%i
::****************
goto :eof
:getlen2
set n=0&set "s=!str!"
:loop
set /a n=!n!+16
set "m=!s!fedcba9876543210"
set "s=!str:~%n%!"
if defined s goto loop
set /a %1=0x!m:~16,1!+!n!-15
set /p =.<nul
goto :eof
:ret
set /p =.<nul
set "ret=%~1"
if not defined ret goto :eof
set "ret=!ret:a2a= !"
set "ret=!ret:22=2!"
set "ret=!ret:""="!"
echo !ret!>>out!file!
goto :eof
[ Last edited by netbenton on 2009-1-24 at 02:38 ]作者: yishanju 时间: 2009-1-24 04:01 本来回你的贴就没什么恶意的意思,居然被你咬成这样,又是我骂我充内行又是说我抄袭的。令人感慨
你在某个论坛上,发了某篇帖子,然后我都不是按你的希望来回复的,你就愤怒了是吗?
[ Last edited by yishanju on 2009-1-24 at 04:14 ]作者: netbenton 时间: 2009-1-24 13:08 标题: re 12楼
@echo off&setlocal ENABLEDELAYEDEXPANSION
::所有set /p只是用来显示进度
set "cut="要去除的串列表" "注意:" "用空格隔开," "和用双引号引起来""
::读取所有txt文件
for /f "delims=" %%a in ('dir /b /s *.txt') do (
set "file=%%a"
rem 直接替换原文件,不产生临时文件
rem 读取文本,丢掉空行
for /f "tokens=*" %%b in ('type !file!^&cd.^>!file!') do (
cls
echo.&echo.&echo.&set /p =正在处理请稍候.<nul
set "str=%%b"
call :sub
)
echo.完成.. &type !file!
pause
)