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.
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.
@Harka Won't work. That won't pass the contents of the buffer as input to !command. The contents of the buffer can either be piped into the command or piped out of it, but not both.
ed(1) conference
in reply to Jonathan Lamothe • • •For just capturing the output of a command, you can use:
r !somecommandBut 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, atmuxbuffer or whatever). There's no analog to:10,20! rot13offered 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.Jonathan Lamothe likes this.
ClaudioM reshared this.
Jonathan Lamothe
in reply to ed(1) conference • •ed(1) conference
in reply to Jonathan Lamothe • • •Using temporary/transient storage can avoid the temp-file cleanup step though:
or
Ameliorates it by a wee bit, but still a hassle that I'd fix if I had a time machine
Jonathan Lamothe
in reply to ed(1) conference • •ed(1) conference
in reply to Jonathan Lamothe • • •xclipinstead (similar functionality on X),pbcopy/pbpasteon OSX, or some similar tool on Wayland or Windows.emilia microsystems likes this.
buffet, das
in reply to ed(1) conference • • •Jonathan Lamothe
in reply to buffet, das • •SirWumpus 🍁⚔️ 🛡️
in reply to Jonathan Lamothe • • •ednot that I know. Withex/vi/ehyes. They have pipe through command some region of the buffer or all of it, eg.!{fmt -w68Harka
in reply to Jonathan Lamothe • • •Jonathan Lamothe
in reply to Harka • •!command. The contents of the buffer can either be piped into the command or piped out of it, but not both.