Say I have some arbitrary multi-line text file:
sometext moretext lastline
How can I remove only the last character (the e, not the newline
After a whole bunch of playing around with different strategies (and avoiding sed -i or perl), the best way i found to do this was with:
sed '$! { P; D; }; s/.$//' somefile