Take a look at the VI tutorial "Mastering the VI editor" at httphttp://www.eng.hawaii.edu/Tutor/vi.html#simple

The VI editor is a screen-based editor used by many Unix users.

If you use vi, do the following. Suppose you want to manipulate the file "t6.data", type

vi t6.data

Once the file is opened you can delete entire lines by typing

dd

In order to jump to the last line in the file, you type

Shift-G

Once you are done, you type

:wq

to save results or just

:q

(changes will not be saved) and hit RETURN.

Here are some more useful VI commands

a enter insert mode, the characters typed in will be inserted after the current cursor position. If you specify a count, all the text that had been inserted will be repeated that many times.

h move the cursor to the left one character position.

i enter insert mode, the characters typed in will be inserted before the current cursor position. If you specify a count, all the text that had been inserted will be repeated that many times.

j move the cursor down one line.

k move the cursor up one line.

l move the cursor to the right one character position.

r replace one character under the cursor. Specify count to replace a number of characters

u undo the last change to the file. Typing u again will re-do the change.

x delete character under the cursor. Count specifies how many characters to delete. The characters will be deleted after the cursor.


Last edited on Tuesday, September 16, 2003 9:35:04 am.

Valid XHTML 1.0! Valid CSS!
Page Execution took 2.648 seconds