echo "hello world" >> dummyfile cat dummyfile | sed 's/hello/goodbye/' > dummyfile
if you do:
cat dummyfile | sed 's/hello/goodbye/' | sponge dummyfile
AKA
sed -i 's/hello/goodby/' dummyfile
https://www.freebsd.org/cgi/man.cgi?query=sed
http://man.openbsd.org/OpenBSD-current/man1/sed.1
http://netbsd.gw.com/cgi-bin/man-cgi?sed++NetBSD-current
Does the '>' operator blanks the file first, before the read happens?
This isn't the issue.
if you do:
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.