Currently doing a little experiment in the shell.
My commands are the following :
echo 'This a cool butterfly' > test sed 's/butterfly/parrot/g' test > test
But then when I am doing a simple cat on my test file, the file is empty. Why?
You can't read and write to a file at the same time. In resume, sed is reading your file 'test', but you are writing to this file in the same time, so the result is a empty file.
sed -i 's/butterfly/parrot/g' test
With this the file will be edited in place.