On Thu, Jun 06, 2002 at 02:11:31AM -0500, Jesse Angell wrote: > Okay, > There is a file lets call it user.conf > on line 23 of the file there is a line that says > user=blahblah > I want to have a varible in a script.. $user = john > that edits user.conf and changes user=blahblah to user=thevarible$user... > How would I do this.
sed can do it but you need to write the script to a temporary file then move it back over the original file. sed "s/user=\(.*\)/user=${thevariable}\1/" < user.conf > a mv a user.conf Alternatively use an embedded ed script. thevariable=whatsup ed - user.conf << EOE /user= s/user=\(.*\)/user=${thevariable}\1/ w q EOE _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list