"Bob Puff@NLE" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I need to have a shell script (and/or CGI) be able to modify the
> contents of an existing file (to which it has permission). Let's say
> that somewhere in the file "test.conf", there is a line that says
> "test=on". I would like to be able to change that one line to
> "test=off" or "test=something else". I don't want anything else in the
> file modified - stuff before or after this line.
>
> How do I do it?
>
> Bob
>
#!/bin/bash
THEFILE=/where/ever/it/is
mv $THEFILE $THEFILE.orig
sed 's/^test=on$/^test=off$/' $THEFILE.orig > $THEFILE
# test this script before putting in production.
# all warranties null and void, including fitness for a particular
# purpose.
# yadda yadda yadda.
;-) hope it helps, anyway....
(and again, there are a million ways to skin that cat also...)
rc
Rusty Carruth Email: [EMAIL PROTECTED] or [EMAIL PROTECTED]
Voice: (480) 345-3621 SnailMail: Schlumberger ATE
FAX: (480) 345-8793 7855 S. River Parkway, Suite 116
Ham: N7IKQ @ 146.82+,pl 162.2 Tempe, AZ 85284-1825