Login
You're viewing the functional.cafe public feed.

Replies

  • Sep 23, 2026, 7:10 PM

    @me

    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.

    💬 1🔄 2⭐ 0
  • 💬 1🔄 0⭐ 0
  • Sep 23, 2026, 7:21 PM

    @me

    Using temporary/transient storage can avoid the temp-file cleanup step though:

    w | xsel -ib
    ,d
    r !xsel -ob | rot13

    or

    w ! tmux loadb -
    ,d
    r !tmux showb | rot13

    Ameliorates it by a wee bit, but still a hassle that I'd fix if I had a time machine :flan_XD:

    💬 1🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • Sep 23, 2026, 9:19 PM

    @me

    Depending on your platform, you might have xclip instead (similar functionality on X), pbcopy/pbpaste on OSX, or some similar tool on Wayland or Windows.

    💬 0🔄 0⭐ 0
  • Sep 24, 2026, 8:43 AM

    @me 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.

    💬 0🔄 0⭐ 0