I think your task can be done in a single loop. Are you familiiar with reading/writing files? If not, recommend spending a little time on the home page's FAQ section, VB6 & Earlier. The logic below is described in the Files faq.
Don't know how big the files are; you have 2 basic options, read entire file into memory & manipulate it, then output. Or use 2 files, open one for reading and the other for writing.
pseudo code looks a little like this, using 2 file method. Split() & Join() are VB commands.
Code:Open File for reading Open File for writing Begin loop Read line of input Does it begin with N? If not keep reading until it is found or end of file occurs once found ... Replace N with new N ' to replace a token in the line.... Split() line on delimiter -- appears to be spaces Change value as needed Join() split line using same delimiter Write modified line to file Increment N Continue Loop Close both files Delete old file, rename new file if needed done




Reply With Quote