|
Quick & very dirty solution
I don't have time to write the code for you but you could do the following:
When updating...
grep the file for the original value,
generate new value...
pipe the file through sed and insert new value using s/// substitution.
This in no way counters the issue of file locking and temporary re-writes (i.e. output of sed overwriting original input). You can get away with it on small files but I wouldn't risk it in a professional system.
Alternatively, use Perl and the "profile" handler header that acts just like Get Private Profile in Windows API.
|