I've always been fascinated by various UNIX text processing tools. They're so tiny and concise yet so powerful. One day when I was learning sed (text stream editor), I got curious about how are all these text editing tools related. There are so many different ones – ed, ex, sed, vi, vim, and more. What do they have in common and what have they borrowed from one another?
I was not perfectly sure if 'sed' has originated from 'ed', so I Google searched for 'sed history' which turned up some interesting results, one of them being "The original users manual for sed, by Lee E. McMahon, from the 7th edition UNIX Manual (1978)".
Quoting the manual "Sed is a lineal descendant of the UNIX editor, ed." Great! I knew that 'sed' was non-interactive text editor whereas 'ed' was an interactive one. Also I knew that 'ex' was improved 'ed' and that 'sed' was a non-interactive 'ed' and that 'ex' had become 'vi' and was used in 'vi' command line mode. To boost my vi/vim skills and get a touch on how text editing was done with just 'ed', and satisfy my historical curiosity I set myself a goal to learn it.
As I mentioned in awk and sed cheat sheet posts, the best method for me to learn a new tool is to have all commands in front of me, so when I am doing experimentation I can quickly find the command and also see all the other commands at the same time, blowing them in subconsciousness.
Since 'ed' is line-oriented text editor, it is important to understand the line addressing, this cheat sheet summarizes the line addressing.
Most of 'ed' command are single letter in length. This cheat sheet summarizes all the commands, showing the supported address ranges and a detailed description of each command.
From my experience, once I had completed this cheat sheet and had it in front of me, I picked 'ed' up in 30 minutes. And then spent a few more hours experimenting and trying various constructs.
Download ed Cheat-Sheet
- Plain Text (.txt): ed.unix.text.editor.cheat.sheet.txt
- PDF document (.pdf): ed.text.editor.cheat.sheet.pdf
- MS Word (.doc): ed.text.editor.cheat.sheet.doc
- Bonus –
sedcheat sheet: sed cheat sheet
Have fun learning ed and see you next time!