Vi 101 - One, Two, Buckle My Shoe...
(Page 6 of 9 )
One of vi's most powerful features is the ability to automatically repeat a command a specified number of times, by preceding the command with a number. For example, let's suppose you needed to delete eight lines of a document. Based on what you've just learnt, you would use the
dd
command eight times, creating the truly horrible command
string
dddddddddddddddd
What you could have done, had I informed you of it earlier,
was
8dd
As you'll see when you try it out, this simply executes the
command eight times, deleting eight lines from the document without needing you to run to the drugstore for an aspirin after. And this technique can be used with any of the commands you've already learned - you can use it to copy multiple lines, repeat insertions a specified number of times, and even move the cursor to specific occurrences of words within the document.
This article copyright 2000. All rights reserved.Next: Searching For Hope >>
More Administration Articles
More By Vikram Vaswani, (c) Melonfire