John Stockton
2021-11-30 14:03:07 UTC
I want to copy an HTML page file to another file, omitting both the heading+introduction and the tailpiece. For test I use a line of four hashes as separator, and a test file :
head
####
want
####
tail
My non-working test code is in :
@echo PRUNE.BAT JRS 2021-11-30+ ???
@echo.
@if not exist zzz\nul mkdir zzz
@echo 1111
@SET ZC=0
@echo. Start > ZZZ\ORIG.HTM
@FOR /F "eol=; tokens=*" %%J IN (PRUNE.DAT) DO @(
@echo Comment line='%%J' ZC=%ZC%
if [%ZC%] == [1] (
echo '%%J' >> ZZZ\ORIG.HTM
)
if [%%J] == [####] (
set ZC=1
echo === %ZC%
)
@echo ++
)
@echo 9999
@echo. Ended >> ZZZ\ORIG.HTM
@echo.
type ZZZ\ORIG.HTM
@echo PRUNE.BAT ends.
The apparent problem is that the line set ZC=1 has no effect, so that the wanted part is not copied. ( I intend to change it to set /A ZC=1+%ZC% which should mean that the tail part is not copied). Subsequently I may use a line as an invisible separator.
What's wrong?
head
####
want
####
tail
My non-working test code is in :
@echo PRUNE.BAT JRS 2021-11-30+ ???
@echo.
@if not exist zzz\nul mkdir zzz
@echo 1111
@SET ZC=0
@echo. Start > ZZZ\ORIG.HTM
@FOR /F "eol=; tokens=*" %%J IN (PRUNE.DAT) DO @(
@echo Comment line='%%J' ZC=%ZC%
if [%ZC%] == [1] (
echo '%%J' >> ZZZ\ORIG.HTM
)
if [%%J] == [####] (
set ZC=1
echo === %ZC%
)
@echo ++
)
@echo 9999
@echo. Ended >> ZZZ\ORIG.HTM
@echo.
type ZZZ\ORIG.HTM
@echo PRUNE.BAT ends.
The apparent problem is that the line set ZC=1 has no effect, so that the wanted part is not copied. ( I intend to change it to set /A ZC=1+%ZC% which should mean that the tail part is not copied). Subsequently I may use a line as an invisible separator.
What's wrong?
--
(c) John Stockton, near London, UK. Using Google Groups. |
(c) John Stockton, near London, UK. Using Google Groups. |