6 ms·
(Attribution is questionable, but as a geezer I feel the need to make sure the younger generations at least are familiar with this:) ed is the standard text ed
by bandrami 9y ago
(Attribution is questionable, but as a geezer I feel the need to make sure the younger generations at least are familiar with this:)
ed is the standard text editor
Let's look at a typical novice's session with the mighty ed:
golem> ed
?
help
?
?
?
quit
?
exit
?
bye
?
hello?
?
eat flaming death
?
^C
?
^C
?
^D
?
---
Note the consistent user interface and error reportage. Ed is
generous enough to flag errors, yet prudent enough not to overwhelm
the novice with verbosity.
(As a geezer, I also have to say I really am impressed with ed in some ways, and you should never be afraid to try it when you have a specific and known edit you want to do.)
- geofft 9y ago"When I use an editor, I don't want eight extra KILOBYTES of worthless help screens and cursor positioning code! I just want an EDitor!! Not a “viitor”. Not a “emacsitor”. Those aren't even WORDS!!!! ED! ED! ED IS THE STANDARD!!!" https://www.gnu.org/fun/jokes/ed-msg.txt https://www.gnu.org/fun/jokes/ed-msg.txt
- srcmap 9y agoUsing vi/vim lets one enter a secret dark corner of programmer society. Memorize vi keystrokes is knowing the secret handshakes. Able to Exit vim is finding the door to enlightenment. If vi comes with an easy "back" button like all browsers, no-one will learn it. One needs to be trapped inside for a while to feel the power of the dark side.
- throwaway7645 9y agoIs ":q!" really that crazy after 2 secs with Google?
- entelechy0 9y agoI always use ZZ
- Certhas 9y agoYes it is, if you are coming from a GUI life, start using the shell for the first time, and suddenly get thrown into some unnamed editor by git. :P It breaks about every convention on editors and discoverability that you're used to. Start GNU nano. It puts me in a position where typing edits the file I opened. It shows me the name of the program. It shows some keyboard shortcuts for interacting with the program. (Though for beginners the ^X syntax isn't obvious either). Vim, doesn't give me any of that. I infrequently use vim and I still tend to open a file and start typing without hitting i first, because it's behaviour that's inconsistent with every single other editor I have ever used.
- netzone 9y agoMy worst memories of starting out with programming is doing a git merge or pull, then before the command was done, I'd start typing git push or... and then I got stuck in insert mode. This was after I had learned that :q och :wq! did the job, and I could not for the life of me figure out how to get out of insert mode. Fun times.
- throwaway7645 9y agoOr because every other editor you've had is inconsistent with Vim. It is dumb if people are being dumped there by Git. I guess if you try to use it and get stuck it is a lot easier to escape than if someone gets dumped there without even knowing where they are.
- kefabean 9y agoOr (I'm surprised it's not been mentioned already): Shift-ZZ to save and close (saves an extra keystroke)
- deleted 9y ago[deleted]
- kccqzy 9y agoI find that with a specific and known edit, it's far easier to do using sed and awk. In particular awk Has better power-to-weight ratio at traditional text processing. I think typical awk scripts could very well be shorter than the equivalent python scripts that do the same thing.
- bandrami 9y agoAwk is probably the most powerful "taken for granted" utility in all of the unix ecosystem.
- throwaway2016a 9y agoI have written hundred+ line awk programs. For stream text editing it is excellent at what it does and it's install base is huge. Rarely do I encounter a *nix machine without it on there.
- throwaway7645 9y agoPerl & Python are also installed on most UNIX machines I've seen. I know Perl was invented to address weaknesses with Awk. I use all 3 to some degree, but is there a reason you like Awk?
- flukus 9y agoThe pattern -> action format of awk is really nice for simple apps, it's a built in for loop + switch statement that reads from stdin. It's also simple to change what the record/column seperators are, so it can handle some quite complex data shapes with zero code. Awk and python don't deal with stdin/stdout quite as nice (AFAIK) and there is always the temptation to do too much with them. As an example, the other day I wrote a DSL in awk, it takes a mostly CSV file in and outputs sql commands. If you did it in python you could run the sql directly, but the awk stdio version makes it easier to combine as needed. If I want to run the generated sql I can pipe that to the sql cli client, if I need to hand it to QA I can just pipe to a file etc.
- 9y ago
- FreeFull 9y agoAlso keep in mind that ex is a part of vi and vim, and is an improved version of ed. All : commands in vi(m) are actually ex commands
- bandrami 9y agoExcellent point. I'm an Emacs guy by habit, but I'm also a sysadmin, which means I keep a well-stocked repertoire of ex commands ready for when the shit really hits the fan.
- iamacynic 9y agoex is a good way to script in-place text edits using the commands you're familiar with in vim. just be careful.
- waldir 9y agoAfter reading lots of similar anecdotes about Ed (Steven Levy's "Hackers" dedicates quite a few words to it), I was quite sure it was pretty much unusable for today's UI patterns, but also morbidly curious about how it might eventually work. Then I came across "Actually using ed"[1], which did such a great job at explaining how to use the tool that I decided to throw in my 2 cents by submitting an entry to the tldr-pages project[2]. The rendered page looks can be found on [3]. Any feedback welcome! 1. https://sanctum.geek.nz/arabesque/actually-using-ed/ https://sanctum.geek.nz/arabesque/actually-using-ed/ 2. https://github.com/tldr-pages/tldr/pull/944 https://github.com/tldr-pages/tldr/pull/944 3. https://github.com/tldr-pages/tldr/blob/master/pages/common/ed.md https://github.com/tldr-pages/tldr/blob/master/pages/common/...
- JdeBP 9y ago... and discussed on Hacker News recently at https://news.ycombinator.com/item?id=13113556 https://news.ycombinator.com/item?id=13113556 .
- aequitas 9y agoI recently had to use ed. I wanted to write a handful lines of code, but for that I needed the context that was in the terminal history. I didn't want to keep switching back and for with vi. So I decided this was the time I should learn ed. It did the job it was expected to do, I was not disappointed.
- bandrami 9y agoSame way I came to it. It's exactly what it claims to be, nothing more or less, and it does what it does very well.
- jzl 9y agoI got a kick out of discovering recently that there are still significant new releases of ed. For example: http://lists.gnu.org/archive/html/bug-ed/2017-01/msg00002.html http://lists.gnu.org/archive/html/bug-ed/2017-01/msg00002.ht...
- agumonkey 9y agoI love ed
- deleted 9y ago[deleted]