LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-12-2003, 12:50 PM   #1
dnla
LQ Newbie
 
Registered: Sep 2003
Posts: 14

Rep: Reputation: 0
Editior automatically delete content between lines


Hello!
I have a very simple question. I would like to automatically delete the content between certains words in a large file.
For example
I have

Word1
blah blah
blah blah
Word2

I would like to have
Word1
Word2

I the large file I have several instances of Word1 and Word2 so doing it by hand wouldn't be a fun thing to do. I am sure there are million ways of doing that. I tried vi (which is sure capable of doing that) but could only delete contents on the same line...
Any help would be nice.

>>MM
 
Old 10-12-2003, 12:57 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
If you only want to see lines that contian Word1 or Word2 in a file you can use:
grep -e "Word1\|Word2" /path/to/file
 
Old 10-21-2003, 04:57 PM   #3
dnla
LQ Newbie
 
Registered: Sep 2003
Posts: 14

Original Poster
Rep: Reputation: 0
I found a way:
vi editor

:/Word1/,/Word2/d

thats it...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Udev] Can I delete the content of /dev? lokee Linux - Software 6 02-04-2005 08:30 PM
delete content form a file bru Programming 1 04-30-2004 07:41 AM
delete some lines from a file freelinuxcpp Linux - Software 4 01-17-2004 10:28 AM
How does one delete directories with content as the SU? Ferrell Ramey Linux - General 2 08-22-2002 07:16 PM
How to delete a dir and all it's content? ReSync Linux - Newbie 2 06-29-2002 06:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration