problem in using sed command in editing a file

Hi all,

I have a conf file, i want to update some entries in that conf file. Below is the code for that using a temporary file.

sed '/workgroup=/ c\workgroup=Workgroup' /usr/local/netx.conf > /usr/local/netx.conf.tmp
mv -f /usr/local/netx.conf.tmp /usr/local/netx.conf

Sample contents of netx.conf :-

workgroup=Workgroup
Use=hosts
security=user1
....
...

I do not want a .tmp file ,please let me how can i update an entry in a file without using a temp file.
Is it possible using awk ??????
Thanks all !!

sed '/workgroup=/ c\workgroup=Workgroup' * /usr/local/netx.conf/ > /usr/local/netx.conf

if yours is GNU, you will get '-i' option in sed which does what you need.

Check if your sed supports the -i option, the so-called in-place editing.

sed -ie 's/THIS/THAT/' file

i tried all the given commands.....
Whats happening is EITHER 'the new valus is getting prefixed with the old value'(workgroup=newold) OR 'file contents get duplicated (file contents gets repeated).

Even i tried the below ones ,sill aint able to find a soln :

sed -i -e 's/workgroup=/workgroup=NEW' filename
perl -pi -e s/"${workgroup=}"/"${workgroup=NEW}"/g

Try

after exec the command:

sed -i -e 's/workgroup=.*/workgroup=NEW' netx.conf

I get some error as ------:

sed: -e expression #1, char 28: unterminated `s' command
sed -i -e 's/workgroup=.*/workgroup=NEW/' netx.conf

------

this has worked for me :

sed -i -e '/security=/ c\security=domain' netx.conf

Here,I'm searching for the pattern "security=" and changing that pattern to "security=domain" with "c/".

but can anyone tell me weather it is correct and what is happening exactly????