I think I might be able to write you working code but I ask instead you to work on the semi-code.

you already know what you want to do.

readline from the initial
loop while more lines
in the loop do the action
and probably write the results somewhere

like you see, you have at least one loop too much, one file too much.
yep, you go for too complex.

oh, and you should keep in mind that kixtart reads lines from starting of the file one by one.
so just taking of one line of the file and continuing the read is actually same as reading the line and copying every other line to new file and copy the new file on place of the old...
and re-open.
I don't think that is what you want to do [Wink]
_________________________
!

download KiXnet