I am using sed in a script to do a replace and I want to have the replaced file overwrite the file. Normally I think that you would use this:
% sed -i \'s/c
A lot of answers, but none of them is correct. Here is the correct and simplest one:
$ echo "111 222 333" > file.txt $ sed -i -s s/222/444/ file.txt $ cat file.txt 111 444 333 $