The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Attn Ufiecle: Unix/Linux shell scripting (sed) by leonidus 2007-04-20 02:10:35
I have a configuration file I want to edit from a script. Specifically uncomment a certain line. The sed syntax is straight forward. I am using:

sed "s/#something/something/" config_file

That gives me the correct result on stdout. The question is is there some easy/standard way to redirect the output to the file again?

I already tried the normal shell output redirection, but that left me with an empty file afterwards. I could go with a temporary result file that will be copied over the original file, but I am of the impression, that there should be some better way to do this.
[ Reply ]
  my proceeding in that case by c3po2007-04-20 02:25:05
    Yes. That's the procedure with an intermediate ... by leonidus2007-04-20 02:32:22
      jep, the backup is fine in some cases :o) by c3po2007-04-20 02:56:24
  Never mind. Found something. by leonidus2007-04-20 02:30:00
    gnu sed has an in-place option, -i ... by livingbread2007-04-20 04:00:54
      Oh. Thank you. (n/t) by leonidus2007-04-20 04:27:30

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)