I was fooling around in the terminal and I just wanted to ask why this command here doesn’t work:
sed ‘s/snow/rain/g’ forests.txt > forests.txt
What I thought would happen was that all entries containing snow would be changed to rain, and then that resulting file would be overwritten to forests.txt. However what actually happens is that it deletes everything in the forests.txt file, meaning there will no longer be any entries in the file.
Can anyone explain why that happens?