The GNU line editor. It can save some serious ass. Let's create a file, save it, edit it, move stuff around.
Starting 'ed'
ed is not always included, so you might wat to install it. Have a try, in your terminal, enter
Code: Select all
ed
Code: Select all
P
Creating a new file
Creating a new file happens by appending lines to the existing file (which is of course not existing yet), so let's append:
Code: Select all
a
Code: Select all
bbq@grill $ ed
P
*a
This is line 1
And this is line 2
This is the last line.
.
*
Save and Quit
Let's just imagine we want to write this file to disk and then quit (much like :wq) - save it as 'pensi.txt'
Code: Select all
w pensi.txt
Code: Select all
q
Code: Select all
Q
Tomorrow: edit an existing file, search and replace.