Technology TidBits

Answers to various technical questions on php programming, mysql, linux, and many more categories.



How can I delete a large chunk of text using vi?

Last updated: 07/01/2009
Add comment
Votes: 0
Comments: 0

Sometimes your finger gets tired of using the "x" key in vi, which only removes one character at a time.  To wipe out a huge chunk of text, a long string, or multiple paragraphs, you can use this command:

1.  First, here's an example line:

print "The quick, brown fox jumps over the lazy dog.";

2.  Assume you want to delete everything between the quotes (").  Position the cursor on the "T" after the first set of quotes.

3.  Type: d/" [enter] - this should delete everything until the next ". 

4.  You can delete huge chunks of content by adding a unique string at the bottom of the content you want to delete.  With the "d" command in vi, you can search for full words, case sensitive, etc.

 


Other questions in this category:
How do I set Tab stops in VI?
How can I turn on line numbering in Vi?
How can I jump to a line in the vi editor?
How can I remove DOS linebreaks (^M) from my files?
How can I remove leading whitespace in all lines in a file using vi?
How can I undo and redo changes in vi?
How can I search in the vi editor?



Powered by KnowledgebasePublisher 1.1
Superb Internet
Content provided by Roberts WebForge, Inc.