The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-22-2005
Simerian Simerian is offline
Registered User
 

Join Date: Oct 2003
Location: United Kingdom
Posts: 37
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.
Reply With Quote