View Single Post

  #1 (permalink)  
Old 04-01-2006, 08:02 PM
sparky sparky is offline
Member
User
 
Join Date: Mar 2006
Posts: 35
Rep Power: 0
sparky
Default Appending text files

I am making my server script big and better but once again i have run into trouble with what i thought would be the simplest parts of the script.
I want delete one line from a text file and replace it with new.
ie
delete password"*" from text file and add new password"$"
from what i have read the command > deletes all and adds new
and >> just adds new line to rest .
using google i have seems some thing on sed and awk so i assume i need to use one of them by maybe making a new file then appending then rename back to old but not quite sure how
Have tried this
sed -e 's/rcon_password "*"/rcon_password "foo"/g' server.cfg > server1.cfg

but the out is this
rcon_password "foo"origanpass"
so the wild card is not getting rid of old pass
any help would be great

Thanks
Reply With Quote