mardi 30 décembre 2014

Echoing stdin when running an ed(1) script


Given the following ed script,



$ cat helloworld
a
hello
world
.
,n
,s,o,O,g
,n
Q


I would like to obtain somehow the interactive output



$ ed
a
hello
world
.
,n
1 hello
2 world
,s,o,O,g
,n
1 hellO
2 wOrld
Q
$


instead of the expected



$ cat helloworld | ed
1 hello
2 world
1 hellO
2 wOrld
$


Is that possible, maybe using a third-party utility? Thanks in advance!


Edit: I guess I should add some motivation. I would like to produce some sample ed sessions, and probably save them with script(1). If this process is performed "live", any modifications would basically imply typing the whole tutorial again (bad) or alternatively "figuring out" the output, potentially based on a long editing session (worse).



Aucun commentaire:

Enregistrer un commentaire