Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
10-20-2011, 10:35 PM
|
#1
|
|
LQ Newbie
Registered: Oct 2011
Posts: 8
Rep: 
|
how do you replace text between two words in a whole file not just 1 line w/ sed/awk
For example, if I wanted to replace everything between WORD ONE and WORD TWO bellow, how can I do it?
Quote:
|
A paragraph (from the WORD ONE blah blah blah blah blah blahahaaahhh bblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah WORD TWO blah blah blah blah blah blah blah blah blah blah blah blah
|
|
|
|
|
10-21-2011, 12:15 AM
|
#2
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Hi, welcome to LQ!
Are these on one line, or several? From your sample it looks as if they
are one line, wrapped around.
Cheers,
Tink
|
|
|
|
10-21-2011, 12:58 AM
|
#3
|
|
Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 6,306
|
And what have you tried? I see you mention sed and awk ... have you tried either? are you stuck? if so, where?
|
|
|
|
10-21-2011, 05:44 AM
|
#4
|
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,568
|
Please use [code][/code] tags around your code, to preserve formatting and to improve readability.
Do not use quote tags for this purpose.
|
|
|
|
11-03-2011, 04:47 PM
|
#5
|
|
LQ Newbie
Registered: Oct 2011
Posts: 8
Original Poster
Rep: 
|
Code:
blah blah WORD ONE blah blah blah blah blah blahahaaahhh bblah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah b
lah blah blah blah blah
blah
blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah WORD TWO blah
blah blah blah blah blah blah blah blah blah blah blah
|
|
|
|
11-04-2011, 12:04 AM
|
#6
|
|
Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 6,306
|
Is there a question here? Just looks like more data to me.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:31 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|