setlocal disabledelayedexpansion
set "newtext=some other text here"
(for /f "tokens=1* delims=]" %%a in ('find /n /v "" temp.txt') do (
echo %%b|findstr /rc:"\ *\"test\":\ \".*\"" >nul && (
for /f "delims=:" %%c in ("%%b") do echo %%c: "%newtext%"
) || echo/%%b
))>yourtempfilename.txt 2>nul
它保持格式和空行,但是某些毒害字符存在一些问题(这就是为什么2>nul;尽管输出正常)
2019-12-10 23:09:50
企业邮箱发送邮件时,若出现投递失败产生退信,内容提示包含如下: the mta server of * reply:550 failed to meet SPF requirements 或者 the mta server of 163.com — 163mx01.mxmail.netease.com(220.181.14.141) reply:550 MI:SPF mx14,QMCowECpA0qTiftVaeB3Cg—.872S2 1442548128 http://mail.163.com/help
302303