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

Thanks for putting me in the right direction. I'm still confused. Will this jump down into my file, start where "arcserve.nlm" is found and print out every line, line by line, until two consecutive blank lines are found, then exit? I don't know if I was clear enough about what I was trying to do. If this is true, where should I insert this code into my scrip? Again, thanks for your help.
  • Comment on Re: Re: Searching for variable then blank lines

Replies are listed 'Best First'.
Re: Re: Re: Searching for variable then blank lines
by tstock (Curate) on Mar 14, 2002 at 05:54 UTC
    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