Цитата Kamerad:
помощи обычно bat файла это можно реализовать? »
|
Код:
@Echo Off
SetLocal EnableDelayedExpansion
:: Файл из которого берем 3 строки (8,9 и 10 строки)
Set infile1=e:\Temp\866.txt
:: Файл из которого берем все строки и заменяем 3 строки (20, 21 и 22)
Set infile2=e:\Temp\log.txt
:: Файл, получаемый после замены 3-х строк
Set newfile=e:\Temp\out.txt
Set cnt=7
For /f "skip=%cnt% usebackq delims=" %%a In ("%infile1%") Do (
Set /A cnt +=1
If !cnt! LSS 11 (Set $!cnt!=%%a) Else GoTo _skip
)
:_skip
Set cnt=0
(For /f "usebackq delims=" %%a In ("%infile2%") Do (
Set /A cnt +=1
Set line=%%a
If !cnt!==20 Set line=%$8%
If !cnt!==21 Set line=%$9%
If !cnt!==22 Set line=%$10%
Echo !line!
))>"%newfile%"
Pause>Nul