File processing

Hello,

I am trying to find a solution which could be simple rather than coding unnecessary code. Scenario I have is :-

I have a line sequential text file and while reading the file I need to call some kind of program which does data transfer, and read next so on... The issue I have is I have to process 5 lines at a time, and when 5th one finishes I need to read the file and process so on..... SO always 5 process should be running.. Any help?

Thanks

A sample input and a desired output would be a good start (using the code tags of course).

What scripting language are you planning to use?

Perl? PHP? Bash? Ksh? other?

I am using ksh

need sample of i/p & desired o/p please.