Hi!

I want to write portable ed(1) scripts that work on both GNU and BSD
ed(1)-s. The only hurdle to that so far is word boundary regex, which is
\< / \> on GNU and [[:<:]] / [[:>:]] on BSD. Both are extensions beyond
POSIX, but ultimately useful. I’m using these. And, to make my ed(1)
scripts portable across implementations, I have to preprocess them with
yet another script (so meta) to replace GNU-style word boundaries with
BSD-styles ones. Something like:

H
!# Meta boundaries for ed-generated scripts
g|\\\\[>]|s||\[\[:>:\]\]|g
g|\\\\[<]|s||\[\[:<:]\]|g
!# Regular boundaries
g|\\[>]|s||[[:>:]]|g
g|\\[<]|s||[[:<:]]|g
w
q

Is there maybe a possibility that GNU ed(1) (as the one most expansive
and portable) might support BSD-style word boundaries? That’d make a lot
of scripts immediately portable across major implementations, bringing
much joy to the people.

Best of luck,
-- 
Artyom Bologov
https://aartaka.me

Reply via email to