ed

an example of ed on the OpenBSD ksh fc command which edits last entered command and executes it.
; man ed
; is just my prompt.
; fc
the command to edit previous
7
ed outputs character count
i
"i" commands writes a line before
echo 
a single space character follows
.
a dot alone on a line leaves input mode
j
"j" command joins two lines
p
"p" command prints
echo man ed
ed outputs the result
wq
the command to write and quit
12
ed outputs result character count
echo man ed
fc or ed (?) echoes the whole result
man ed
result of our command, echo of previous
;
just my ";" prompt again.