GNU ed 1.15
lists.gnu.org
lists.gnu.org
1992 M.I.T. Class Ring
Description
2 city skylines are etched along the edges of this gold ring.
The face features a busy beaver. The name "Patrick J. LoPresti"
is engraved in script on the interior.
I wonder if it's a tribute because of his joke.Ex doesn't have much in the way of features that demand an upgrade.[1] Vi is too heavyweight; waiting for the screen refresh is tedious.
[1] Although I recall using it. No idea why. (Mmmmm, 1200bps modem from a C-64.)
We were pretty into the Church of the Subgenius around that time.
e.g. it was 'standard' aka invoked by default as $EDITOR as opposed to say ex or teco, etc.
so calling it 'standard' was a good thing here, since it informed you about how the system worked..
I have to admit that I never encountered a situation where `ed` might have been my tool of choice.
For a while I maintained a .html blog using only ed, just for the fun of abstaining from conveniences and learning to use an ancient program. It's somehow nice to know that it's possible.
This patch was explicitly rejected in upstream openssh as they said it could lead people to copy and paste it without considering attacks - but ignored the fact that by just telling people what file it was in, many people just deleted the file in response and those who did it right, deleting just the relevant line in cases where a key change was expected like my situation, never discovered the easier ssh-keygen -R method.
Perhaps they shouldn't offer a copy and paste solution, but mentioning that ssh-keygen is capable of it and to see the docs would be nice at least...
This assumes authenticated DNS data, of course. Not at all a given today, sadly.
`sed -i '398d' ~/.ssh/known_hosts`
I do this all the time. In fact I have a function in my .bashrc for this at work since I use it so much:
`function sedkey() { sed -i "${1}d" ~/.ssh/known_hosts }`
so I can run `sedkey 123` etc. Just another way to skin a cat I suppose.
ktm5j@kurma /pool/share/pkgs $ ed ~/.ssh/known_hosts
130923
398d
wq
130755
Sed just quietly does what I want. Like I said, just another way to skin a cat, do whatever works for you.Also, btw, you can absolutely use ed in scripts [0], but this is also something that I would pity the maintainer of.
[0] https://www.ibm.com/developerworks/community/blogs/brian/ent...
For larger things I find vi or something else of that scale more convenient. Ed just seems to fill a space between the two that I never need.
kate filename:line
CTRL+K (or CTRL+D to comment out), CTRL+S, quit (current tab: CTRL+W, Alt+Tab or app: CTRL+Q)
Particularly useful when the output of the previous command (compilation for instance) already contains filename:line. Then double click, middle click paste works well.
or: kate filename
CTRL+G line <Enter>, CTRL+K, CTRL+S, quit.
ed the_file <<< $'398d\nwq'
edit: another one liner but still using ed I guess.
ed was built for this kind of system where limited I/O was a requirement for reasonable performance. If transferring a file is too expensive, you can't wait for the system to redraw the entire screen of 25 lines and 80 columns because you scrolled past the bottom of the screen, either.
To load up a 25x80 area would give me all sorts of bad characters. Doing single lines, and find and replace made it almost feel like I was right next to the hardware.
Back in the day, it's amazing how much code one could write in these relatively primitive line-oriented editors (ed on Unix systems, editors like SOS and EDT on DEC operating systems, and so on).
E.g. the entire UNIX (including the userland).
Machines were smaller then, too. 64K of code on a PDP-11, small ROMs (hundreds of KB) for the larger embedded systems.
My belabored point: Systems were smaller. There was a lot less typing involved :-)
There are a bunch more, but nothing that really covers my early experience with Unix. Something about "common tools of the late 1970s line-oriented computing environments" might be an interesting subject, we'll see . . .
ed saved me that day.
A couple of years ago I had to boot a Debian/68k virtual machine and both vi and emacs were absent (there was joe, but at the time I wasn't aware that such editor even existed, and I wouldn't have assumed it came preinstalled anyway).
Well, ed was there.
Quite a challenge to use it because my ed-fu is weak at best, but I was able to edit the necessary files to configure networking and to be able to ssh into the machine.
I also use it in some administrative tasks, like editing dhcp.config files on BSD.
None of these happen very often.
If I have a more built-up system, I'll use mg, which is the gnu version of microEmacs.
$ uname -s; head -n 19 /usr/src/usr.bin/mg/README
OpenBSD
[This is an edited version of the original mg README, updated slightly to
reflect changes in the last 20 years.]
Mg (mg) is a Public Domain EMACS style editor. It is "broadly"
compatible with GNU Emacs, the latest creation of Richard M.
Stallman, Chief GNUisance and inventor of Emacs. GNU Emacs (and other
portions of GNU as they are released) are essentially free, (there are
handling charges for obtaining it) and so is Mg. You may never have
to learn another editor. (But probably will, at least long enough to
port Mg...) Mg was formerly named MicroGnuEmacs, the name change was
done at the request of Richard Stallman.
Mg is not associated with the GNU project, and it does not have the
copyright restrictions present in GNU Emacs. (However, some modules
do have copyright notices.) The Mg authors individually may or may
not agree with the opinions expressed by Richard Stallman in "The GNU
Manifesto".Fun fact: MicroEmacs, precursor to mg was written by David G. Conroy while at Mark Williams Company, working on the compiler to run on the DEC Rainbow.
David went on to work on the DEC Alpha, and is now at Apple.
Also, when I teach programming languages, ed is a useful enough project to start on. The editor is simple. So students can focus on language concepts for the most part, while still getting a useful software at the end (I assume regex libraries are available).
In one of them, a FreeBSD system's `/usr` and `/home` slices got corrupted, but they still had entries in `/etc/fstab`. The mount failures prevented further recovery. There were, however, a handful of binaries under `/bin`. Guess which one is really good at editing `/etc/fstab`...
ed is just one of those things I keep in the back of the toolbox that gets pulled out occasionally.
Walked him through using ed to change it. He thought it was some arcane magic.
The difference is that ed reads the entire input in memory, but it doesn't break symlinks. sed's in-place editing mode (just like perl -i or the newer awk -i inplace that is supported by GNU awk) breaks symlinks, on the other hand it can operate on arbitrarily large files.
you can also do
sed -i -e 's/a/b/' file
which will work for GNU and BSD sed.[1] https://www.amazon.com/Ed-Mastery-Standard-Unix-Editor-ebook...
"....
"•insert, remove, and mangle text"
Yep. That's ed.
Undefined behavior isn't necessarily something that should be fixed, in all cases. In some cases, it explicitly cannot be fixed, as it is undefined explicitly due to known differences in machines.
Why would you want undefined behavior?
If you have not read it before, you might find "The Value of Undefined Behavior" informative: https://nullprogram.com/blog/2018/07/20/
I uploaded the whole changelog[1] if anyone wants to read it in a slightly more convenient way than downloading the source tarball.
As far as ed is concerned some bytes are being pushed around between stdin/stdout/your file, and it does not mangle them so everything works.
So even with creeping featurism, POSIX_ME_HARDER and other GNU mainstays, I wouldn't think that after the 1.0 release you'd need plenty of new releases.
GNU tar is at 1.3x, and is probably both a bigger bug vector and target for "please add this --long-option-for-edge-case".
[0]: http://edbrowse.org/
From there I followed a link by the author of edbrowse, Karl Dahlke, called "Command Line Programs for the Blind" [1] which is a great read in general and a really good reminder that accessibility is so important.
https://jvns.ca/blog/2018/05/11/batch-editing-files-with-ed/
One thing that I miss and apparently is still not there is the ability to use '*' in place of '1,$' that was in the MWC Coherent version.
[1] https://www.autometer.de/unix4fun/coherent/
The source code is on VM images, which run fine under QEMU:
(It does that, or stands-in for the actual filename, or something else :/ )
In 1972, Carl Mikkelson produced the first collection of TECO Editor MACroS.
In 1976, Richard Stallman collected all publicly available TECO Editor MACroS into a single distribution, creating EMACS.
Was this due to an autotools version bump?
Really made my day!