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
Here's another using ex, which I find not as cryptic as the sed solution:
ex
printf '%s\n' '$' 's/.$//' wq | ex somefile
The $ goes to the last line, the s deletes the last character, and wq is the well known (to vi users) write+quit.
$
s
wq