I need help with vi


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers I need help with vi
# 1  
Old 12-31-2007
I need help with vi

Hi:

I know how to delete a block between two patterns, using :/pattern1/,/pattern2/d

However I would like to delete the same pattern in the entire file because this block appers several times in the file.

Thank you for your help
Best
Fabian
# 2  
Old 12-31-2007
This works for me in vim on Ubuntu 7.10:

Code:
:g/pattern1/,/pattern2/d

Cheers....Cassj
# 3  
Old 01-01-2008
Code:
:1,$/pattern1/,/pattern2/d

1,$ indicate range - starting from first line to the last line
# 4  
Old 01-01-2008
Thank you guys!!!!
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question