Sed has a handy (but dangerous!) in-place substitution ability, but it can be tricky to use.
From the man and help pages it would seem doing sed -i 's/hello/goodbye/g' helloworld.txt would be the way to achieve it.
It doesn't, and you'll either get a script processing error or something like: sed: -i: No such file or directory.
The trick, is to use it like this: sed -i '' 's/hello/goodbye/g' helloworld.txt