1.Starting vi and dabbling with it
Code Block |
---|
|
vi
i # get into input mode
:a # add text after the cursor |
In input mode, type anything you want.
2a2.Saving in vi:
Get out of input mode and into command mode
Code Block |
---|
|
:w vi_file_name # save theas a vi file |
2b.If you have saved the file once, just use
...
3.Exiting vi:
...
Code Block |
---|
|
vi vi_file
ESC
:r import_file |
6. Searching and replacing in vi:
6a.find a string of text in vi:
vi vi_file
Code Block |
---|
|
/text # look for "text" |
...
get the first result, and press N to find the next one.
6b. search and replace in vi:
vi vi_filename
Code Block |
---|
|
%s :%s/text/newtext # replace "text" with "newtext" |