in reply to Re: Re: Searching for variable then blank lines
in thread Searching for variable then blank lines

yes, it does what I think you want.

$s is true if you found the starting string, false otherwise
$b only gets to 2 if it finds two blank lines in a row
we only end the loop if we found two blank lines ($b) and a start ($s)
we only print if we found a start ($s)

(might make more sense if read from the bottom up, but then it wouldn't work correctly)

This code works for big and small files alike, but for smaller files you can always try a regular expression if it's easier for you. If you don't use the array, this code actually has no memory problems handling very large files.

Tiago
  • Comment on Re: Re: Re: Searching for variable then blank lines