Using sed to destroy a file

This happened:

$ sed 's/one/two/g' file.c > file.c

Opening the file shows an empty file. So, make sure not to do this!

I was lucky because sed prints its output to the command-line with the p flag, and I could copy-paste the original contents.

I do not usually do this for any commands; for some reason, I thought the file would be completely read into memory and the output would cleanly populate the old file.