in reply to Re: Counting between the lines
in thread Counting between the lines
As long as the "current word" doesn't return to being one for which we'd already starting counting lines, there's no need to keep the data in memory. Emit it as you gather enough of it.