You are on page 1of 4

OSY EXP 9

Program Code :
Create a file fruits and type at least 30 lines
in it.

After:

press ‘esc’ and then press ‘A’ to write the


text at the end of current line

iii) Replace some character into beginning


of second line.

Output :

Contents of fruits file: i) Write command to


save the file.

Output :

ii) Write the command to insert text at the


end of line.

Output :

Output before pressing ’A’


OSY EXP 9

v) Write a command to move cursor 3 word


to the right

Output :
command : in command mode type ‘3l’

iv) Write a command to delete 10 lines at a


time.

Output :
command: in command mode type ‘10dd’

XIII Exercise :
1) Write the significance of following..

i) $ vi temp.txt .
Output :

ii) Insert multiple lines.


Output :

iii) Delete contents using commands.


Output :

a) Press ‘5x’ in command mode


OSY EXP 9

a) Press ‘D’ in command mode

b) Press ‘X’ in command mode

b) Press ‘dd’ in command mode

c) Press ‘d^’ in command mode


2) Create a new file and practice executing
shell commands from within the editor.
Capture the results of some shell commands
into the file.

Output :

Vi command:

Moving within a file:

i)Move the cursor up one line press


‘esc+k’

d) Press ‘d$’ in command mode


OSY EXP 9

ii) Move the cursor down one line i) Inserts text before the current
press ‘esc+j’ cursor location ’esc+i’

ii) Inserts text at the beginning of the


current line ’esc+I’

iii) Move the cursor to the right one


character position press ‘esc+l’
iii) Inserts text after the current cursor
location ’esc+a’

iv) Move the cursor to the left one


character position press ‘esc+h’

iv) Inserts text at the end of the


current line ’esc+A’

Editing Files(Inserting):

You might also like