The UNIX and Linux Forums
Forum Home
Linux and Unix Man Pages
Search Forums
Search Community Posts
Today's Posts
Quick Links
Man Pages
RedHat Commands
OpenSolaris Commands
Linux Commands
SunOS Commands
FreeBSD Commands
All UNIX Man Pages
All Linux Man Pages
Full Man Repository
Login or Register to Ask a Question and Join Our Community
Search Forums
Show Threads .
Show Posts
Tag Search
Advanced Search
Quick Links
Contact Us
Forum Rules
Today's Posts
FAQ
Pictures & Albums
All Albums
Miscellaneous
What is My IP
Whois
Mark Forums Read
UNIX for Dummies Questions & Answers
I need help with vi
Tags
beginners
,
linux
,
need help
,
ubuntu
,
vi
,
vim
Thread Tools
Search this Thread
Top Forums
UNIX for Dummies Questions & Answers
I need help with vi
#
1
12-31-2007
Fabduarte
Registered User
2,
0
Join Date: Dec 2007
Last Activity: 1 January 2008, 8:41 PM EST
Posts: 2
Thanks Given: 0
Thanked 0 Times in 0 Posts
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
Fabduarte
View Public Profile for Fabduarte
Find all posts by Fabduarte
#
2
12-31-2007
cassj
Registered User
109,
0
Join Date: Jul 2003
Last Activity: 4 November 2010, 8:37 PM EDT
Location: Interweb
Posts: 109
Thanks Given: 0
Thanked 0 Times in 0 Posts
This works for me in vim on Ubuntu 7.10:
Code
:
:g/pattern1/,/pattern2/d
Cheers....Cassj
cassj
View Public Profile for cassj
Find all posts by cassj
#
3
01-01-2008
Yogesh Sawant
Registered User
1,213,
19
Join Date: Sep 2006
Last Activity: 2 March 2020, 5:24 AM EST
Location: Rossem, Tazenda
Posts: 1,213
Thanks Given: 7
Thanked 19 Times in 18 Posts
Code
:
:1,$/pattern1/,/pattern2/d
1,$ indicate range - starting from first line to the last line
Yogesh Sawant
View Public Profile for Yogesh Sawant
Visit Yogesh Sawant's homepage!
Find all posts by Yogesh Sawant
#
4
01-01-2008
Fabduarte
Registered User
2,
0
Join Date: Dec 2007
Last Activity: 1 January 2008, 8:41 PM EST
Posts: 2
Thanks Given: 0
Thanked 0 Times in 0 Posts
Thank you guys!!!!
Fabduarte
View Public Profile for Fabduarte
Find all posts by Fabduarte
Login or Register to Ask a Question
Previous Thread
|
Next Thread
Login or Register to Ask a Question
Member Badges and Information Modal
×
Featured Tech Videos