AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox

01.01.2013 Views

VI ( 1 ) VI( 1) file to newtext :gftextfs/ fnewtextfp Change first appearance of text in each line in file to newtext and print each changed line :g/ text/sf/ newtextf c List one at a time each line with text and change as required to newtext using a y :(mj,(njgf text/ sf/ newtext Change first appearance of text in each line in file to newtext :(mj,(njgf text/ sf/ newtextf p Change first appearance of text in lines from m to n to newtext and print each changed line :(mj,(njgf text/sf/ newtextf c List one at a time each line with text from m to n and change as required to newtext using ay MANIPULATING FILES Copy From Another File :r file Copy file into buffer after current line :(njr file< CR> Copy file to buffer after nth line Copy To Another File Note: Follow entry with . :w file :w! file :w>>file :(mj,(njw file :(mj,(njw ! file :(mj,(njw > >file Edit Current File :w :w file "e! :f AG :ta. tag A] Edit Other Files :e file Write the current file to file Overwrite existing file with file Add current file to end of file Write lines m through n to file Overwrite existing file with file containing lines m through n Add lines m through n to end of file Write changes to current file Write file to current unnamed file Reedit current file, discarding changes since last write Show current file and line Synonym for :f To tag file entry tag :ta., following word is tag From Current File Edit file when write has occurred in current file, return to shell after edit, changes not lost in current file - 6 -

VI (l) :e! file :e + name :e + n :n :n args :e # 'f VI (l) Edit file when no write has occurred in current file, return to shell after edit, changes list in current file Edit starting at end Edit starting at line n Edit next file in list when vi was called with more than one file Specify new list of files to be edited Edit alternate file when two files are being edited Synonym for :e # . ESCAPING TO THE SHELL :sh Start a separate shell (to run several commands), return with 'D :!command Run one shell command, then return to current buffer MARKING AND RETURNING Previous context mx 'x 'x o o • at first non-white in line Mark position with letter x to mark x 0 0 0 at first non-white in line MISCELLANEOUS OPERATIONS Repeat the last append, insert, open, delete, change, or put command Switch character from lowercase to uppercase and vice versa '? Delete or rubout interrupts i Split a line before the cursor a. Split a line after the cursor 'L Reprint screen if '? scrambles it J Join lines :nu Line number cursor is on xp Switch characters SETTING OPTIONS Initializing Options :set x :set nox :set x=val :set :set a.ll Enable option x Disable option x Assign a value to x option Show changed options Show all options - 7-

VI (l)<br />

:e! file<br />

:e + name<br />

:e + n<br />

:n<br />

:n args<br />

:e #<br />

'f<br />

VI (l)<br />

Edit file when no write has occurred in<br />

current file, return to shell after edit, changes<br />

list in current file<br />

Edit starting at end<br />

Edit starting at line n<br />

Edit next file in list when vi was called with<br />

more than one file<br />

Specify new list of files to be edited<br />

Edit alternate file when two files are being<br />

edited<br />

Synonym for :e # .<br />

ESCAPING TO THE SHELL<br />

:sh Start a separate shell (to run several commands),<br />

return with 'D<br />

:!command Run one shell command, then return to<br />

current buffer<br />

MARKING AND RETURNING<br />

Previous context<br />

mx<br />

'x<br />

'x<br />

o o • at first non-white in line<br />

Mark position with letter x<br />

to mark x<br />

0 0 0 at first non-white in line<br />

MISCELLANEOUS OPERATIONS<br />

Repeat the last append, insert, open, delete,<br />

change, or put command<br />

Switch character from lowercase to uppercase<br />

and vice versa<br />

'? Delete or rubout interrupts<br />

i Split a line before the cursor<br />

a. Split a line after the cursor<br />

'L Reprint screen if '? scrambles it<br />

J Join lines<br />

:nu Line number cursor is on<br />

xp Switch characters<br />

SETTING OPTIONS<br />

Initializing Options<br />

:set x<br />

:set nox<br />

:set x=val<br />

:set<br />

:set a.ll<br />

Enable option x<br />

Disable option x<br />

Assign a value to x option<br />

Show changed options<br />

Show all options<br />

- 7-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!