普通替换,搜一下多省事... 写个保持原文本空行的
@echo off
set "fp=%cd%\文件夹"
set "fn=a.txt"
set "ss=x.x.x"
set "sd=a.b.c"
set/p=处理中. . .cd/d "%fp%"
(for /f "tokens=1* delims=:" %%i in ('type "%fn%"^|findstr/n ".*"')do (
set "s=%%j"
title . %%i
setlocal enabledelayedexpansion
if defined s set "s=!s:%ss%=%sd%!"
echo.!s!
endlocal
))>"%temp%\%fn%"
move "%temp%\%fn%" .
echo ok
pause
@echo off
setlocal enabledelayedexpansion
(for /f "delims=" %%a in ('type %cd%\文件夹\a.txt') do (
set str=%%a
set str=!str:x.x.x=a.b.c!
echo !str!
)
)>%cd%\文件夹\new_a.txt
echo end...
pause
BBdoc文档搜索工具支持word Excel pdf txt csv等各类文档内容快速搜索。