I am trying do the following -
I have to parse multiple files (numbers can vary from 1 to 50+), and in each file, I need to find a segment of lines that start with a specific entry and process all lines below that entry. The number of lines above that varies (anywhere from a 50 to 50000 lines). Here is what I tried -
@echo off
setLocal EnableDelayedExpansion
for /F %%A in (%file_list%) do (
SET file_name=%%A
:: -----Check if file is missing-----
if not exist !file_name! (
SET SuccessFlg=P
goto End
)
:: ----Check for Statistics----
for /F "tokens=1,* delims=:" %%A in ('find /c "Summary" !file_name!') do SET var1=%%B
if !var1! equ 0 goto End
for /F "tokens=1,* delims=[]," %%i in ('find /n "Summary" !file_name!') do SET LineNoSrc=%%i
for /F "skip=%LineNoSrc% tokens=1-13* delims=[],:()> " %%a in (!file_name!) do (
some commands)
goto End
)
:End
@echo on
I tried both %LineNoSrc% as well as !LineNoSrc!. Neither of them seem to work.
How do I fix this?
Thanks
Skip lines inside nested for loop
Moderator: DosItHelp
-
- Posts: 126
- Joined: 10 Jun 2011 10:30
Re: Skip lines inside nested for loop
Try this:
viewtopic.php?f=3&t=1989
Just remove the exit/b in the forloop. And if you want to stop searching the file when you are done parsing the bottom lines, put the exit/b inside the top loop.
You're on the right track though...
viewtopic.php?f=3&t=1989
Just remove the exit/b in the forloop. And if you want to stop searching the file when you are done parsing the bottom lines, put the exit/b inside the top loop.
You're on the right track though...