Then you wonder why it doesn’t work in your other environment. Then you find that GNU vs BSD sed have different syntax.
Better to start with Python once you’re doing more than coordinating well known other tools.
Unfortunately, ed has been omitted from the default installation of recent debians, at least. I had to install it manually.
If I wanted an OS without a text editor, I'd use emacs.