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

Usually when I need to replace some lines in a file, the first tool that comes to mind is sed -i:

sed -i 's|tool:.*|tool: some-tool|' 

However, it's inconvenient when there are . characters in the replacement string:

sed -i 's|host:.*|host: 127\.0\.0\.1|' 

Is there a better tool for this case?

share|improve this question
up vote 3 down vote accepted

. doesn't need to be escaped in the replacement, only in the regular expression.

share|improve this answer

You must log in to answer this question.

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