Ex is the right way to edit files (sed is a stream editor). Besides 'sed -i' is
not POSIX. However ex cannot edit multiple files in one call, thus leading to a
great performance loss when called over a bunch of files. In that case, 'sed -i'
may be a better idea.