I have written several scripts -- some throwaway, some not -- that use ed. If you know what you need to do to edit a file and need it automated, ed is just super handy. Here is a shell script that deletes all comments from a yaml file, then comments out a particular key: ed $file
Ed is the standard text editor (2014)
61–70 of 125 posts
Re: Ed is the standard text editor (2014)
#62Re: Ed is the standard text editor (2014)
#63Earlier quoted context omitted.
In most cases I find `sed -i` to be more convenient than using ed in scripts, but the paradigm is a little different.
Except for when it breaks on FreeBSD or macOS. The most portable utility nowadays for desktop systems is ex, actually (because some Linux distros don’t include ed).
It is still much more usable than ed. At least, it makes it easier to debug your script.
Re: Ed is the standard text editor (2014)
#64I have written several scripts -- some throwaway, some not -- that use ed. If you know what you need to do to edit a file and need it automated, ed is just super handy. Here is a shell script that deletes all comments from a yaml file, then comments out a particular key: ed $file
One thing I do like about ed, though, is that when I run eshell within emacs, I can call ed from there. Since ed doesn't make any assumptions on the capabilities of the terminal it runs on, it works perfectly well in that environment, and being able use another editor from within my editor made me very happy for a couple of minutes. ;-)
Re: Ed is the standard text editor (2014)
#65Perhaps it's better to see for a minute how people used this kind of editors when they first appeared, than to keep reading about them for ages: https://youtu.be/b6URa-PTqfA?t=100 (BBC from '79, mentioning how people start working from home with the aid of newfangled microcomputers and network connectivity). I'm reminded most of all of the fdisk util, where the workflow is pretty much the same: print, modify, print,…
Re: Ed is the standard text editor (2014)
#66I find ed to be the perfect program to test a new programming language. It demands good support for strings, regexes and data structures while being reasonably sized to be completed in under a week. I polished my C skills as I was learning it by writing this from scratch[1]. [1] Shameless plug, here it is: https://github.com/bojle/edd
Re: Ed is the standard text editor (2014)
#67There's no reason to use ed. It's a historical novelty at this point. Move on.
"oh no i reinstalled the os on my vps and now ssh has it on good authority (said authority is line 68) that someone is doing something nasty" ed .ssh/config 68d wq done, didnt fill my terminal with vim or emacs, didnt tab over to my gui editor then back again also it's a nicely "semantic"/compact/comprehensible way of expressing patches in things like portfiles or nix expressions: postPatch = '' ed Makefile etc etc s…
Re: Ed is the standard text editor (2014)
#68Perhaps it's better to see for a minute how people used this kind of editors when they first appeared, than to keep reading about them for ages: https://youtu.be/b6URa-PTqfA?t=100 (BBC from '79, mentioning how people start working from home with the aid of newfangled microcomputers and network connectivity). I'm reminded most of all of the fdisk util, where the workflow is pretty much the same: print, modify, print,…
whoa! What did I just see!? Could someone please explain to me how that telephone head set placed next to printer thing contraption works?
Re: Ed is the standard text editor (2014)
#69Perhaps it's better to see for a minute how people used this kind of editors when they first appeared, than to keep reading about them for ages: https://youtu.be/b6URa-PTqfA?t=100 (BBC from '79, mentioning how people start working from home with the aid of newfangled microcomputers and network connectivity). I'm reminded most of all of the fdisk util, where the workflow is pretty much the same: print, modify, print,…
whoa! What did I just see!? Could someone please explain to me how that telephone head set placed next to printer thing contraption works?
Re: Ed is the standard text editor (2014)
#70Earlier quoted context omitted.
That's a neat way to think of it. Coming from the other direction, for emacs users, using the command line is like using the editor since the gnu readline lib offers keyboard navigation like emacs.
Except ^W performs a completely different action. I can't count the number of times after switching from a terminal to Emacs within a couple of seconds, my muscle memory still not updated, I hit ^W only to discover I've just deleted 3/4 of the file.
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-c\C-k" 'kill-region)
;; https://www.reddit.com/r/emacs/comments/5jbvc3/kill_is_now_cc_ck_instead_of_cw/