[comp.editors] Deleting lines in Vi

carterp@cc.wbl.deakin.OZ.AU (Phil Carter) (11/28/90)

In Vi, how does one delete all lines containing a certain character
string?

Similarly, how does one delete all lines NOT containing a certain 
character string?

--
  Phil Carter		  Computing Services Centre,   
  Academic Programmer  	  Deakin University, Warrnambool campus          
  carterp@deakin.oz.au    Princes Highway,		             
  Tel: +61 55 618427      Warrnambool 3280,  AUSTRALIA

rouben@math13.math.umbc.edu (Rouben Rostamian) (11/28/90)

In article <980@sol.deakin.OZ.AU> carterp@cc.wbl.deakin.OZ.AU (Phil Carter) writes:
>In Vi, how does one delete all lines containing a certain character
>string?
>
>Similarly, how does one delete all lines NOT containing a certain 
>character string?


To delete all lines containing "pattern":
	:g/pattern/d

To delete all lines not containing "pattern":
	:v/pattern/d

--
Rouben Rostamian                            Telephone: (301) 455-2458
Department of Mathematics and Statistics    e-mail:
University of Maryland Baltimore County     bitnet: rostamian@umbc
Baltimore, MD 21228,  U.S.A.                internet: rostamian@umbc3.umbc.edu