Live data from Hacker News

Ed is the standard text editor (2014)

wiki.c2.com

61–70 of 125 posts

Re: Ed is the standard text editor (2014)

#61

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

[deleted]

Re: Ed is the standard text editor (2014)

#62
I hate to be that guy, but 'ed' is very unix specific. In the mid-1970's (and apparently as early as the 1960's according to Wikipedia), those of us on TOPS/10, TOPS/20 (and perhaps other DEC systems) were using TECO (which of course became EMACS).

Re: Ed is the standard text editor (2014)

#63

Earlier 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).

Well, of course, sed is not the stantard...

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)

#64

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

That's nice. I'd probably user Perl for this, but I happened to stumble upon Perl just in time to make sure I'd never become a shell wizard. Anything more complex than a couple of canned commands and maybe a loop, and I go for Perl.

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)

#65
post #27

Perhaps 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)

#66

I 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

This could be an interesting challenge: speedrun up to full ed from just cat/tail/echo/head, shell redirects, and compiler of your choice.

Re: Ed is the standard text editor (2014)

#67
post #18

There'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…

IIRC, it is mandated by POSIX/SUS, so even if it ends up not being used ever, to deliberately not include it is ... doesn't feel right.

Re: Ed is the standard text editor (2014)

#68
post #27

Perhaps 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?

http://www.columbia.edu/cu/computinghistory/couplers.html

Re: Ed is the standard text editor (2014)

#69
post #27

Perhaps 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?

The printer thing is a teletype. Think of it as a terminal onscreen, but...the text actually gets printed to typewriter paper line by line. The phone thing is almost certainly an acoustic coupler for a 300-baud modem, hooked to the teletype. You'd dial the modem pool for the server you were trying to connect to, and when you heard the happy modem noises come through the handset, you'd slam it down on the two rubber cups, and your modem/terminal would do the Hayes AT dance, and a point-to-point data connection would be established. 300 baud was good for printing teletypes, as the mechanical printhead can only move so fast....

Re: Ed is the standard text editor (2014)

#70
post #46

Earlier 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.

You know, I never put it into words myself, but me too. Here for us and others:

  (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/
Post reply on HN