home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,837 of 68,980   
   John Stockton to All   
   Problem with file trimming in Batch   
   30 Nov 21 06:03:07   
   
   From: dr.j.r.stockton@gmail.com   
      
   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?   
      
      
   --    
     (c) John Stockton, near London, UK.  Using Google Groups.           |   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca