Why does redirection to the same file truncate the file?
When you use I/O redirection like that, both the "input" & "output" file are opened by the shell before the command is executed. And opening a file for overwriting is the same as truncating it before writing. The result: cat
sees an empty file on input...