Does anybody know which version of sed is required to get option -i
to work? I am on CentOS5 and I am getting this error.

- 16,994
- 7
- 46
- 48

- 16,753
- 40
- 98
- 125
2 Answers
I don't think you can get -i to work then.
I think this other SO question may help you out:
sed -i + what the same option in SOLARIS
Perhaps the solution isn't as nice as sed -i, however.
If you're going to be using -i
with sed
you're doing it wrong. sed
is a stream editor and it should be used to edit streams, not files, as -i
wants to do.
If you want to edit a file, you should be using ed
. ed
is a line editor and it should be used to edit files. IMO, that's the tool you want to be using.
btw, -i
is a GNUism. from the wikipedia:
GNU sed added several new features. The best-known is in-place editing of files (i.e., replace the original file with the result of applying the sed program), which was later included in BSD sed too. This feature is nowadays often used instead of ed scripts: for example,

- 16,994
- 7
- 46
- 48