September 23, 2016
I’ve been playing with ed. Actually, I spent a little more time with sam’s command language but one sort of lead to the other. Anyway: I’ve been faffing about with old editors.
It looks to me that the ed that ships with OS X is FreeBSD’s ed, with a couple of changes. The change that exercised me the most was finding word boundaries. The syntax for this should be (as in vim) \<
for the start of a word and \>
for the end of a word. Unfortunately man 1 ed
gives us a somewhat cryptic
(This may not be available)
for both expressions. (Hint: it’s not available.) If you poke around in man 7 re_format
you’ll find that word boundary searches are still possible, they’re just a little uglier: [[:<:]]
matches the beginning of a word and [[:>:]]
matches the end.