
CODE: [Copy to clipboard]@echo off
set SrcFile=C:\test\20080311.txt
set DstFile=C:\test\历史纪录.txt
for /f "tokens=*" %%a in ('findstr "便民商店" "%SrcFile%"') do set change=%%a
for /f "usebackq delims= " %%a in ("%DstFile%") do (
if "%%a" neq "便民商店" (
>>"%DstFile%.txt" echo %%a
) else (
>>"%DstFile%.txt" echo %change%
)
)
del /q "%DstFile%"
ren "%DstFile%".txt "历史纪录.txt"
CODE: [Copy to clipboard]@Echo off & SetLocal EnableDelayedExpansion
set dstfile=历史纪录.txt
set srcfile=20080311.txt
for /f "tokens=2 delims==元" %%i in (%srcfile%) do set count=%%i
for /f "delims=" %%a in (%dstfile%) do (
set string=%%a
if "!string:~0,4!"=="便民商店" (
>>_temp.txt echo.便民商店 s=%count%元
) else (
>>_temp.txt echo.!string!
)
)
type _temp.txt > %dstfile%
del _temp.txt & start %dstfile%
CODE: [Copy to clipboard]@echo off&setlocal enabledelayedexpansion
for /f "tokens=1* delims==" %%i in (历史纪录.txt) do (
for /f "tokens=1* delims==" %%a in (20080311.txt) do (
if "%%i"=="%%a" set "%%i=%%i=%%b"
if not defined %%i set "%%i=%%i=%%j"
)
>>tmp_a.txt echo !%%i!
)
move /y tmp_a.txt 历史纪录.txt
pause
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |