One of the nice features of the VIM text editor is the powerful set of editing commands that a user has at his fingertips after he passes the initial learning curve of the system. Naturally, like every other text editor, VIM can search and replace strings of text, but VIM can also include wildcards in its search functions to fill in for information that may be different.
Press "Escape" to enter command mode.
Type the following:
The "." character in VIM is a wildcard character that can fill in for any single character. The above line wold find any word that began with "w" and ended in "th," with any two characters in between, and replace it with the word "wrath."
Press "i" to return to edit mode.
Tips & Warnings
- You can specify characters that can be used in the unknown regions by replacing the "." with the desired letters in square brackets. For example: "w[ie]t" would match both "wit" and "wet."
How to Search & Replace in Vi
Vi is a powerful command line text editor for Unix and Unix variants. One of its features is the ability to search...
How to Use Wildcards to Find and Replace in Excel
Microsoft Excel's Find and Replace feature allows you to search for a particular string of text within functions or cell values. If...
Linux Search and Replace a String in a File
Replacing words within a text file can be accomplished in various ways within the Linux operating system. The "sed" command and the...