non-interactive file editing

I need some help using one of awk / sed / or something else.

ServerName = "Name"
SCPassword = "Password"

This needs to be replaced with:

ServerName = "Different Name"
SCPassword = "Newpass"

So I read up on sed a little, and tried this:

#!/bin/bash

NAME="Different Name"
sed "s/ServerName = "Name"/ServerName = "$NAME"/g" config.txt

Where config.txt is the name of the file I am modding.

This works ok, but the file does not stay changed!

Can someone point me in the right direction?

 

 

 

 

Top