For some reason it took me years to understand the need for a line editor. It didn't make any sense in my head. Then one day I saw the famous picture of Bill and Allen as kids in front of a teletype [1] and it finally clicked. The way it worked was like this: As you keyed in your program, letter by letter, it was printed out on the paper immediately like a typewriter. If you ran the program and there was a problem, y…
Ed is the standard text editor (2014)
41–50 of 125 posts
Re: Ed is the standard text editor (2014)
#42There'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…
sed -i 68d .ssh/config
It was an eye-opening experience for me when I realized sed and ed commands are almost identical
Re: Ed is the standard text editor (2014)
#43Re: Ed is the standard text editor (2014)
#44I 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
Re: Ed is the standard text editor (2014)
#45Not a "viitor". Not a "emacsitor". Those aren't even WORDS!!!! ED! ED! ED IS THE STANDARD!!! TEXT EDITOR.
`The standard unix text editor` has been my Slack bio as long as I can remember for a reason.
Re: Ed is the standard text editor (2014)
#46People make fun of ed, but the command line is basically ed with the ability to execute.
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.
Re: Ed is the standard text editor (2014)
#47There'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…
ssh-keygen -R $HOST
IIRC the security warning actually used to suggest this command, but then stopped in order to discourage people from thoughtlessly bypassing it. (I don’t like this pracrice of deliberate unhelpfulness—cf Chrome’s “thisisunsafe” HSTS override—but neither do I like the results of being helpful in such cases. Ugh.)> also it's a nicely "semantic"/compact/comprehensible way of expressing patches in things like portfiles or nix expressions
As far as I can tell, your ed script sans the wq at the end is a valid sed(1) script, and that is what people usually use for casual patching in packaging situations (although Nix also has substituteInPlace et al).
Re: Ed is the standard text editor (2014)
#48[1] Shameless plug, here it is: https://github.com/bojle/edd
Re: Ed is the standard text editor (2014)
#49Perhaps 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,…
I am sure anyone who worked with gdb without GUI/"dual" mode is aware of this experience.
Re: Ed is the standard text editor (2014)
#50Earlier quoted context omitted.
> ed .ssh/config I think this is my ed use-case as well. I've noticed I need to "apt-get install ed" sometimes. The standard editor is not always standard, it seems.
yeah, unfortunately, despite literally being specified in posix (hell, macos bundles it) one of these days i will go around pestering distro release engineers to include it; after all, it's less heavyweight than any one of their homespun lightdm greeters