sed question

I have been using this type of statement to modify strings within a file

sed -e s/$OLD/$NEW/g ~/file.txt > /tmp/file.txt
mv /tmp/file.txt ~/file.txt

It seems to me that the mv is an extra step probably not necessary. Is there a better way?

Use ed, or (preferably) perl. sed only operates on a stream -- i.e. stdin -> stdout
(thus the name "<STRONG>S</STRONG>tream <STRONG>ED</STRONG>itor")