Did you mention what language you are using?
If its any form of BASIC, grab my SE4 functions module:
http://imagemodserver.mine.nu/other/MM/SE4/Tools
Lots of great stuff there to simplify the reading and editing of the text file lines.
Get/set/add/multiple/exponent the nth value after the ":="
boolean fileExists(filename) too