Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.