Now I'm waiting for EDLIN but with unicode.
I remember you could use it in a batch file to script some kinds of editing by piping the keypresses in from stdin. Sort of a replacement for a subset of sed or awk.
I haven't tried but this should be possible with vi too. Whether that is deeply cursed is another question.
I think ed is what you’re looking for (possibly with -s).