Feature #772
Using Vi to Remove Entire Lines Beginning With a Specific Character
Description
One common task I do is strip down commented configuration files, and rather than spend a lot of time locating and deleting individual line I find vi to be useful for finding and deleting these lines.
- Open the file to be edited:
vi somefile.txt
- To remove all lines beginning with ; (comment character for PHP config file)
:g/^;/d
- To remove all lines beginning with ; (comment character for PHP config file)
Resources¶
Updated by Daniel Curtis over 8 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100