On 07/08/2018 09:35 PM, Dan Cross wrote:
Back in the days of line editors, which read their
commands from the
standard input and were relatively simple programs as far as their user
interface was concerned, you could put a set of editor commands into a
file and run it sort of like a shell script. This way, you could run the
same sequence of commands against (potentially) many files. Think
something like:
ACK
I figured that you were referring to something like that. But I wanted
to ask in case there was something else that I didn't know about but
could benefit from knowing. I.e. vimscript.
$ cat >scr.ed
g/unix/s/unix/Unix/g
w
q
^D
$ for f in *.ms; do ed $f << scr.ed; done; unset f
...
Nice global command. Run the substitution (globally on the line) on any
line containing "unix". I like it. ;-)
The double << is different than what I would expect. I wonder if that's
specific to the shell or appending to the input after the file?
Back in the days of teletypes, line editors were of
course the only
things we had. When we moved to glass TTYs with cursor addressing we got
richer user interfaces, but with those came more complex input handling
(often reading directly from the terminal in "raw" mode), which meant
that scripting the editor was harder, as you usually couldn't just
redirect a file into its stdin.
That makes sense. Thank you for the explanation.
--
Grant. . . .
unix || die