The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 12-10-2004
Lomic Lomic is offline
Registered User
  
 

Join Date: Dec 2004
Location: Paris
Posts: 20
vi + regexp + substitute

Another enigma (for me)

Using VI I edit some files in which I want to erase many lines I don't need anymore

usually I do something like that:
Code:
:%s/line_to_suppress//g

and it is doing fine

but in this case, the pattern to erase contains some special characters

so I do it like that:
Code:
:%s#line_to_suppress_with_special_characters##g

but, the only problem left is that I can't predict what will be the beginning of the line so I wish I could do something like that:
Code:
:%s/*line_to_suppress//g

but of course if I protect the pattern with # to prevent special characters to annoy me... the * don't work anymore

the best way would be to suppress each line containing my pattern, but I don't know how to do that

I'm sure it's pretty easy for many among you, so if one have a bit of time, it would help me a lot

Thanx