For any linux/unix- newbies like me, a quick tutorial on the vi editor might be needed. Here are some short instructions on using it, taken from the “Using Amiga UNIX” manual, page 99-119.
Using the vi editor
This chapter provides a brief overview of basic vi (visual text editor) editing commands. To find out more about vi's advanced commands, read the vi man pages.
To start the vi editor, type vi and the name of your flie. lf you don't include a filename, vi starts editing in an unnamed buffer; you can't save the file until you name it.
The vi editor has a unique editing feature; keys perform differently depending upon what “mode” you're in. vi works in three modes: basic command mode (keys perform editing tasks), file command mode (save and quit), and insert mode (keys insert text characters).
Use the ESC key to end insert mode and return to command mode. When you first enter vi, you're in command mode. You can press an insert command key (such as i) to begin typing text. When you wan to edit your work (to change, add, or delete a word), press ESC to end insert mode and return to command mode. While you're in command mode, the keys on your keyboard issue commands; you can't enter text until you press a insert command key (a, A, i, I, o, O).
You can use the arrow keys to move the cursor around while staying in insert mode. You don't need to press ESC before using the arrow keys; they're not considered command keys, but rather special function keys within insert mode.
If you forget which mode you're in, just press ESC to return to command mode, then start again.
The vi editor doesn't automatically wrap text, so you must press RETURN when you reach the end of a line on your screen.
|ESC||cancel insert mode|
|:q!||quit without saving|
|:wq||save and quit a file|
|:w||save your work|
|:r||file read another file into your current file|
|w||to next word|
|0||back to beginning of line|
|$||to end of line|
|G||to the lastline|
|:n||move to line number n|
|o||add blank line|
|ndd||delete n lines|
|u||undo last change|
|U||undo changes to line|
|.(dot)||repeat last change|
|cc||erase a line and insert|
|c||change to end of line|