Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: 0
Editior automatically delete content between lines

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

blah blah
blah blah

I would like to have

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.

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

Rep: Reputation: 66
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
LQ Newbie
Registered: Sep 2003
Posts: 14

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


thats it...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:23 AM.

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