Join David D. Levine for an in-depth discussion in this video Using lines and ranges in colon commands, part of Learning vi.
…Now I'm going to show you one of vi's most powerful and…esoteric features, which is that when you use a colon command,…you can specify a line or a range of lines upon which the command acts.…When you use this feature, you're actually reaching down through the visual…interface provided by vi, to the EX line editor that's underneath it.…When you use a colon command, you can specify a line, or…a range of lines separated by a comma before the command letter.…This performs the command on the specified lines.…
You can specify a line as a number, which means a line number.…A dot indicating a current line.…A dollar sign meaning the last line of the file, whatever its number is.…An apostrophe followed by a letter, which references a mark.…You can set a mark in the file by moving the cursor to a line and…typing m followed by the letter.…So, for example, you type ma, that sets mark a,…and then you can use that in a colon command by saying 'a.…You can specify a regular expression between slashes, which means the next line…
AuthorDavid D. Levine
- Entering and leaving vi
- Understanding the Command, Insert, and Colon modes
- Moving around in files
- Editing text
- Moving content with delete, yank, and put
- Searching with regular expressions
- Customizing vi
- Filtering text through shell commands
Skill Level Beginner
1. Exploring vi
What is vi?2m 26s
2. Getting Started with vi
3. Moving Around within a File
4. Basic Text Editing
5. Undo, Repeat, Yank, and Put
6. Search and Replace
7. Advanced Editing Features
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.