本帖最后由 aloha20200628 于 2024-11-1 11:10 编辑
回复 3# TXTUSER
二楼代码已订正如下,可以匹配3楼的示例样本了...
- @echo off &setlocal enabledelayedexpansion
- (for /f "delims=" %%s in (原文.txt) do (
- set "s=%%s"
- for /f "tokens=1-4 delims=()" %%a in ("%%s") do (
- for /f "tokens=1-2 delims=,+-/*" %%1 in ("%%b") do (
- for /f "tokens=1-2 delims==" %%x in (
- 'findstr /i "%%1= %%2=" 《字典》.txt'
- ) do set "s=!s:(%%x=(%%y!" &set "s=!s:%%x)=%%y)!")
- if "%%d" neq "" for /f "tokens=1-2 delims=,+-/*" %%1 in ("%%d") do (
- for /f "tokens=1-2 delims==" %%x in (
- 'findstr /i "%%1= %%2=" 《字典》.txt'
- ) do set "s=!s:(%%x=(%%y!" &set "s=!s:%%x)=%%y)!")
- )
- if "%%s" neq "!s!" echo,!s!
- ))>"原文.new.txt" 2>nul
- type "原文.new.txt"
- endlocal&pause&exit/b
复制代码
|