sed to read and write to very same file

This is likely to be a dumb one.

How can I use sed to substitute string occurances having it read from an input file and write to this very same file ?

I have a file with lots of occurances of '2006', I want to change it to '2007', but I'd like these changes to be saved on the input file.

How do I achieve this ?

Thanks in advance,
Abrahao, Brazil.

sed 's'/2006/2007/g' oldfile > tmpfile ; mv tmpfile oldfile

yeah...
I hoped it would be possible in a single command, but, anyway, thanks !

If you want exactly 1 command try perl:

perl -pi -e "s/2006/2007/g" filename

If you're using newer versions of GNU sed:

sed -i 's/2006/2007/g' file

don't take it seriously jim,
there's a typo