in reply to
Simultaneous one by one splitting and processing of an uneven file based on a pattern
So code it up and then ask us for help if you can't get it to work.
Don't use variables a, b and c. You tell us the first variable contains a size or count so the name should include size or count or it should be a word that describes how the count is used. From your description it should be $offset, but maybe you have the maths wrong. Variable names are important, even in pseudo code.
True laziness is hard work