The Ex Editor by Bill Joy (Complete Series)
An editor developed by Bill Joy in 1976.
- To remove double spaces: g/ *// /g
It was based on a program called EM,
which in turn was an improvement of ED
itself developed by Ken Thompson,
one of the original authors of Unix.
Ex is a simple but useful tEXt editor
which itself later became the basis of Vi
which is not to be confused with VIM.
Original Vi was written in 1976
also by Bill Joy.
VIM was only a much later development,
released first in 1991.
But back to EX which is the focus of this video.
EX is a very simple editor helpful for
configuring system files.
Ex is provided by default on Windows, Linux and BSD.
It is the default editor in OpenBSD.
Its strange style arose from limitations
imposed by computing at the time.
This is how it works.
- starting up EX
- Ex does some amazing things
- Lines are not automatically shown at startup
- set line numbers - .exrc
- navigation: beginning/end of file 0/$
- Go to a specific line
- to copy(co), move(m), change(c)
- undo a change (u)
- to append text: a
- to save and quit: w q
- find a word /word g/word
- the origin of grep g/re/p
- to substitute s/word/ newword/g
- to globally substitute g/word/s//newword/g
- regex expressions, examples:
whole words \<word\>
empty lines ^$
letters and numbers [0-9a-z]
not [a-zA-Z0-9 ]
Replace spaces at the beg. of a line: g/^ */s///
Typing vi at the prompt changes to Vi Mode.
But there are some things Ex does better than Vi.
- Write
Replace trailing whitespace: g/ *$///
Delete all blank lines: g/^$/d (d = delete)
proantidisestablishmentarianism