It appears that he's talking about how redirecting the output back into the same file will overwrite it.
This is true of all redirections, whatever the program. The "
>" is processed and the file truncated before the command is ever run, so naturally you'll end up with an empty file. You almost always have to output to a different temporary file and then replace the original with it.
gnu sed has added the '
-i' option, which overwrites the original, but in actuality it just directs the output to a background temp file first anyway. Also, it's not portable since other versions of the program don't have it.
If you want to do true text editing without working with tempfiles, then try using ed instead. It's an actual text editor; it loads the entire file into a memory buffer for editing, and can thus write it back to the original safely. It's also often easier to use when doing multi-line editing.
How to use ed:
http://wiki.bash-hackers.org/howto/edit-ed
http://snap.nlc.dcccd.edu/learn/nlc/ed.html
(also read the info page)
There's also
ex, which has a similar mode of operation and is even more powerful. On Linux it's actually a shell interface for
vim.