本帖最后由 aloha20200628 于 2024-8-3 16:09 编辑
回复 1# 学习1995
帮楼主再省点事儿...
假设转换字典表原始数据有数百行如下
絃 弦
凢 凡
縳 縛
... ... ...
已存为utf-8编码文件 "u8.dic",并置于当前目录下,用以下代码可一气呵成楼主所求...
- @echo off &chcp 65001>nul &setlocal enabledelayedexpansion
- for /f "tokens=*" %%a in (u8.dic) do (set/a "n+=1"&set "_!n!=%%a")
- (for /f "delims=" %%a in (1.txt) do (
- set "s=%%a"
- for /l %%n in (1,1,!n!) do for /f "tokens=1-2" %%x in ("!_%%n!") do set "s=!s:%%x=%%y!"
- echo,!s!
- ))>2.txt
- endlocal&pause&exit/b
复制代码
|