Answer the question
In order to leave comments, you need to log in
How to copy lines after and before certain words?
There is a text file list_all.txt with approximately the following content:
Список хим. товаров:
Крем
Шампунь
Мыло
Лак для волос
Крем
....
еще много строк
....
Список прод. товаров:
....
....
Крем
Шампунь
Мыло
Лак для волос
Крем
....
еще много строк
....
@echo off
set "file=list_all.txt"
set "search=Список хим. товаров"
set "header_line="
for /f "tokens=1 delims=[]" %%a in ('find /i /n "%search%" "%file%" ') do set "header_line=%%a"
if defined header_line (
more +%header_line% "%file%"
) >>list_him.txt
pause
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question