Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
vi editor (Read 4928 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
vi editor
07.02.08 at 14:08:37
 
vi editor
 
The unix/linux vi editor is more than a simpel text editor. Find below a set of commands that can be used.
 
ESC quit the insert mode
:q quit
:q! quit without saving
:w save changes (write)
:wq save changes and quit (write and quit)
ctrl + f move a screen forward
ctrl + b move a screen backward
G go to end of the file
gg go to the beginning of the file
:12 go to line 12
dd delete current line
D delete the remainder of the line
dw delete word
x delete current character
u undo
. repeat last change
i insert text before current character
a insert text after current character
I insert text at the beginning of the line
A insert text addfter the end of the line
o open a new blank line after current line
O open a new blank line before the current line
cw change word
r replace the character at the current cursor position
R replace characters from the current cursor position
:r filename inserts the file at the position of the cursor
 
Cursor movements:
h move left (backspace)
j  move down
k move up
l  move right (spacebar)
w move to the beginning of the next word  
b move to the beginning of the previous word  
 
Source:
http://www.cs.rit.edu/~cslab/vi.html#A1.3
Back to top
 
« Last Edit: 28.05.11 at 10:48:14 by Gerrit-Jan Linker »  

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Re: vi editor
Reply #1 - 31.07.08 at 10:55:35
 
To search a text and replace it with some other text globally you type the following command:
 
:%s/search text/replace text/g
 
To start the search from the current line and to continue to the end of the file use this command:
 
:.,$s/search/replace/g
Back to top
 
« Last Edit: 28.04.10 at 23:18:10 by Gerrit-Jan Linker »  

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
vi macros
Reply #2 - 28.04.10 at 23:20:42
 
vi macros
 
Macros can be recorded in vi. A letter can be assigned to the macro which can be rerun using the @n command where n stands for the letter that was assigned to the macro.
 
To start the macro recorder type q followed by the letter that you want to assign to the macro. Example qe.  
Next perform a set of actions.  
To stop the macro recorder type q again. Now your macro is saved and ready to use.  
Type @e to rerun the macro
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
vi delete lines containing string
Reply #3 - 03.05.10 at 21:13:11
 
vi delete lines containing string
 
To delete all lines that contain a specific string in vi you can use the following command:
 
:g/search/d
 
Where  
g denotes a global search
search denotes the search string
d instructs vi to delete the lines that contain the search string
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1