In reply to Leonid Batkhan.

Hi Leonid,

My intention was just to share a similar case, while also acknowledging the flaw present in this iteration of approaching the issue, so I can't exactly say it's what I was "looking for" -- but I sure am happy to see it! It works beautifully, and as a bonus has a pleasing elegance to it. It seems my using a double ampersand where not needed, is due to a mental holdover from typing &filestem&&count!

Your solution also reshaped my thinking on a closely related piece of code I hope to get to soon, which will split files based on a user-defined number of lines rather than a value taken from the current line. The challenge is that the file being read in has an unknown number of lines, so there is no longer a predefined number of output files. I'll share once I've had a chance to work through it.

Thanks again,
Rebekah