= Ed = '''`ed(1)`''' is a non-visual text editor. It remains a powerful utility for scripted in-place file manipulation. <> ---- == Installation == Most modern systems do not offer `ed(1)`. Instead `ex(1)`, which is bundled within the `vim` package, is symlinked to `ed(1)`. This will be pre-installed on any [[Linux]] or [[BSD]] operating system, as a POSIX utility. ---- == Input Mode == `ed(1)` enters '''input mode''' after one the following commands has been given: * append (`a`) * change (`c`) * insert (`i`) Exit input mode by giving a period (`.`) alone. ---- == Examples == === Insert a Line into a File === Shell scripts make it trivial to append to a file. There are excellent tools such as [[Sed|sed(1)]] for search/replacing text. But there isn't a trivial way to, for example, insert a new line of text into the Nth line of a file. This script demonstrates how such a task could be automated in part. {{{ # Inserts a new third line into the file, # which sets `someYamlProperty` to `true` in a Markdown header of some file. ed "$1" <