Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I have a file a.txt. I would like to replace all instances of "1.6" with "1.5" in that file, overwriting the original file.

share|improve this question
up vote 10 down vote accepted

Using the command line :

sed -i .bak -e 's/1\.5/1.6/g' /path/to/file

This command replace in the file, the orginal file is saved as /path/to/file.bak

share|improve this answer

You can use sed for that:

sed 's/1\.5/1\.6/g' /path/to/file | tee output
also if you are inside an editor like vim, you can do that :

vim /path/to/file
In emacs :

emacs /path/to/file
M-x replace-string

share|improve this answer

Your Answer


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.