in reply to Jonathan Lamothe

For just capturing the output of a command, you can use:

r !somecommand

But if you want to filter a range of lines through an external filter with POSIX ed(1), you need some sort of temporary storage (whether a file, the system clipboard, a tmux buffer or whatever). There's no analog to

:10,20! rot13

offered by vi/vim.

Someone (can't find the post/author at the moment) did hack this functionality into ed, but it's a custom fork of POSIX functionality.

ClaudioM reshared this.

in reply to Jonathan Lamothe

@ed1conf @buffet Sam runs just fine on Linux; I use it there daily (alongside Toronto qed). I think it has been ported to OpenBSD, FreeBSD, and even Windows.

It amuses me that people associate it only with Plan 9; it was originally written for ~9th edition Research Unix, before the Plan 9 project started. (I was there, and an early adopter.)

in reply to Jonathan Lamothe

Toronto qed (descended from ed in the late 1970s, not the 1960s editor that inspired ed) has three commands for exchanging text with other programs:
>command # send to command's standard input
<command # receive from standard output
|command # send to stdin, read from stdout, replacing original addressed lines

Of course > and | take an address range and < a single address, like w and r.

I use | quite often either in ed or in sam; latter written by the guy from whom I caught the qed bug.

Implementing | takes some thought to avoid deadlock if pipes fill and block. Qed does it by spawing a temporary process to do the writing, while the main process reads into the buffer.

This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.

⇧