Re dvliu:
可以用以下的批处理程序:
:: Replace.bat - Sample of replace text
:: Will Sort - 12:47 2005-7-26
@echo off
copy test1.txt test2.txt > nul
echo e 100 "1r|" 1a 0d 0a "e" 0d 0a > _replace.dbg
for %%s in (rcx 9 n_replace.edl w q) do echo %%s >> _replace.dbg
debug < _replace.dbg
edlin test2.txt < _replace.edl
::以下的debug脚本是为文件去处最后的文本结束标记1A,它是edlin添加的
echo e 00 83 e9 01 > _replace.dbg
echo g=00 03 >> _replace.dbg
for %%s in (w q) do echo %%s>> _replace.dbg
debug test2.txt < _replace.dbg
::以上语句删除结束标记1A
for %%f in (_replace*.*) do del %%f
也可以不用edlin实现类似的功能,比如以下的程序:
:: Replace2.bat - An other sample of replace text
:: Will Sort - 12:47 2005-7-26
@echo off
if "%1"=="" cmd /v:on /c %0 cmdshell & goto :EOF
if exist test2.txt del test2.txt
for /f "tokens=*" %%a in (test1.txt) do (
set line=%%a
echo !line:^|=!>> test2.txt
)
Last edited by willsort on 2005-7-26 at 21:30 ]