|The GNU sed version that runs on most Linux systems has an edit in place flag -i that works on the same file:|
sed -i '$d' my.txt
But this won't work on legacy unix systems like AIX, Solaris, HP-UX, etc although GNU versions for these systems are available at gnu.org.
If your system has perl, this one-liner should work:
perl -i -ne 'print unless eof' my.txt