"Plan 9 from User Space" has its own ssam command, whose implementation is basically the same, except as an rc script instead of a shell script.
I don't know if there's an actually-streaming sam implementation anywhere.
https://github.com/deadpixi/sam
Alternatively, the vis editor combines sam's command language with a vim-style modal interface that runs in the terminal, and is therefore even more portable:
An updated version of Plan 9's sam text editor for Unix: https://github.com/deadpixi/sam
tine, a clone of AmigaDOS ED editor: https://github.com/deadpixi/tine
libtmt, a tiny terminal emulation library (as I understand, this is the core of mtm as well): https://github.com/deadpixi/libtmt
and the eregex regular expressions library: https://github.com/deadpixi/ergex
EDIT: Also worth noting is tty8, another tiny terminal multiplexer. All it does is provide 8 virtual terminals and have 3 keybindings for control: https://github.com/dimkr/tty8
Sam alone, however, can be compiled for command line only, without X11 support under Linux. This has been done in the 9base package:
https://git.suckless.org/9base/file/sam/Makefile.html
https://tools.suckless.org/9base/
There is also an updated Linux version of Sam alone, without any other P9 tools. I suppose this should also be trivial to build without X11 support:
You can try a custom sam(1) fork (it uses structural regex, google/ddg them): https://github.com/deadpixi/sam
sam -d for the classic cli mode.