[NTLUG:Discuss] In-place file editor

Leroy Tennison leroy_tennison at prodigy.net
Sat Sep 23 15:23:35 CDT 2006


Looking for a scriptable (non-interactive) program which will modify a 
text file without deleting the original and replacing it with a new 
one.  The reason is that the file has permissions associated with it 
that I don't want to destroy and recreate.  I thought that sed's 'w' 
command would do it:

s/10.12.14.16/2.3.4.5/wfixfile fixfile

but it truncates 'fixfile'.  Problem is that I'm wanting to modify the 
data (change 10.12.14.16 to 2.3.4.5 in the example) in 'fixfile'.  If 
I'm just doing it wrong then please post the way to do it.  If sed isn't 
the program I need then is there one available?

Thanks for the input.



More information about the Discuss mailing list