Vi editor du linux
Par Raze • 20 Octobre 2018 • 846 Mots (4 Pages) • 542 Vues
...
27. Press the Esc key again to leave Insert Entry mode and return to Command mode.
28. Type a colon (:) to go to Last-line mode then save and quit this file when you are finished.
29. Type cat myvifile
30. Can you see the changes you saved. YES or NO
31. Open myvifile, vi myvifile.
32. Move the cursor to the beginning of the 4th line
33. Type o then type in THIS IS HERE
34. Press the Esc key again to leave Insert Entry mode and return to Command mode.
35. Type yy – to copy this line.
36. Move to the line which contains your name.
37. Type P (capital P) – to paste in this line above the existing line.
38. Type p (little p) – to paste in this line below the existing line.
39. Move down to the bottom of the text file.
40. Type a colon (:) to go to Last-line mode then type /THIS to search for this text string.
41. Use the arrow keys to move through the items found.
42. Move to the line which contains your name.
43. Type dd – to delete this line.
44. Type u – to undo this action.
45. Type a colon (:) to go to Last-line mode
46. Then type q! to quit this file without saving any of your changes.
47. Type cat myvifile
48. Can you see the changes you made. YES or NO
Exercise 2 - Create a New File with the vi Editor
1. Type: vi simple
2. Type: This is line1 - vi is simple to use, anyone can use it
3. Copy this line
4. Paste it in four more times.
5. Replace and line number so – it reads from line 1 to line 5.
6. Replace simple into easy and fun.
7. Insert the word ‘Using’ in front of the word vi of the 3rd and fourth lines.
8. Save the file and call it simple.
9. Quit the vi editor
Exercise 3 – Editing an existing file
1. Reopen the file simple.
2. Resave the file with a new filename called exercise3 and quit in the same action.
3. Reopen the exercise3 file
4. Turn on line numbering.
5. Delete the 2nd and 3rd lines.
6. Add a line at the end of the file which says: I’m getting use to the vi text editor.
7. Add a line 2nd from the top which says: Using vi is
...