why?
So this kind of thing should be quite doable in a short ruby script - or a few short scripts - albeit written in "shell" style, with eg '-n or -p (wrap code in "while gets...end",-p with "puts _"), probably along with -a (automatically split lines).
Its in some senses an entirely different dialect of ruby, though.
Some examples here:
https://github.com/learnbyexample/Command-line-text-processi...
It even has it as a feature!
CREATE VIRTUAL TABLE something USING fts5(x, y, z)