Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My configuration file has the following format

[general]
setting1=true
setting2=value2

[ssl]
setting1=sadfsdf
setting2=sdfadsfkljasdf

How would I change setting 1's value to false? If I could just delete the line, I could use the response from another question I asked.

share|improve this question

try something like:

sed -i -r 's/setting1=true/setting1=false/' /path/to/your/file

or if you want to replace all instances of a setting try something like this:

sed -i -r 's/setting1=.*/setting1=false/' /path/to/your/file
share|improve this answer
    
I think you really should spend some time and learn a bit of regular expressions. sed makes a great deal of use on them... and you can easily answer your own questions if you spent 15 minutes learning regexp. – TheCompWiz May 8 '12 at 21:06
    
Just to be sure you should match the start of line (unless your configuration variable names are prefix free): s/^setting1=.*/setting1=bar/ – David Foerster Oct 15 '13 at 19:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .