Posted: . At: 10:16 PM. This was 12 years ago. Post ID: 2609
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

Using the UNIX ed editor. The simplest line editor for writing text files.

The ed(1) line editor is a very useful editor for text files on Linux and it is very simple to use. type ed to start it then to add text to an existing text file, type e my.txt. Then a to append text onto the text file.

[13:20:35-*-homer@hungry-forest Desktop]$ ed
e my.txt
1449
a

Then type away, once you have typed your text, hit CTRL-C to get back to command mode and exit the editor and save the file by pressing w and q to save and exit ed as shown below.

[13:24:17-*-homer@hungry-forest Desktop]$ ed
e my.txt
Newline appended
1793
a
save the file by pressing <b>w</b> and <b>q</b> to save and exit ed.^C
?
w
1793
q
[13:25:31-*-homer@hungry-forest Desktop]$

This is very simple to do and this editor is very fast and easy to use once you get the hang of it. Once you have used ed(1) you will not want to go back to the older style of editors like Leafpad or Gedit. Who needs those types of editors when you can just use the old UNIX line editors and have nothing in your way like spell-checkers or ribbon toolbars.

Here is another example. I loaded an existing text file and added a new line. Then press ^C to exit into command mode and then press w and then q to exit.

┌──(john㉿DESKTOP-PF01IEE)-[~/Documents]
└─$ ed my.txt
15
a
Hello World.
^C
?
w
28
q

This is just like the VIM editor, now too hard to use after all. I wonder how many people actually use this editor, it is a line editor, so you edit by adding lines to a file.

Here is an online manual with more information on the ed editor.

https://www.gnu.org/software/ed/manual/ed_manual.html.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.