MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
May
Sun Mon Tue Wed Thu Fri Sat
       
16
2008
Months
May


Fri, May 16, 2008 4:19 pm

Displaying Line Numbers in Vi

To turn on the display of line numbers in the vi editor, use the following command:

:set number

To turn off the dispaly of line numbers, use the command below:

:set nonumber

[/software/editors/vi] permanent link

Fri, May 16, 2008 3:20 pm

Delete Lines Containing or Not Containing a String Using Vi

To delete all lines containing a string or all lines not containing a particular string, you can use the global search options in the Vi editor.

Global Search

:g/string/command
command affects lines containing string
:v/string/command
command affects lines not containing string

To delete all lines containing "foo" you could use the following command:

:g/foo/d

To delete all lines not containing "foo" you could use the following command:

:v/foo/d

References:

  1. vi Reference Card
    JILA

[/software/editors/vi] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo