If you do something like:
echo "hello world" >> dummyfile
cat dummyfile | sed 's/hello/goodbye/' > dummyfile
dummyfile will be blank afterwardsif you do:
cat dummyfile | sed 's/hello/goodbye/' | sponge dummyfile
It'll work as you'd expect (or at least as I'd expect). Otherwise `> dummyfile` will truncate dummyfile before it's read and inputed into sed.