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 |
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. |
|
 |
05-04-2009, 01:49 PM
|
#1
|
|
LQ Newbie
Registered: May 2009
Posts: 1
Rep:
|
replace a pattern with a line using sed/awk
XML file:
<!--
span.cls_004{font-family:Arial,serif;font-size:12px;color:rgb(51,51,51);font-weight:normal;font-style:normal}
div.cls_004{font-family:Arial,serif;font-size:12px;color:rgb(51,51,51);font-weight:normal;font-style:normal}
span.cls_003{font-family:Arial,serif;font-size:9px;color:rgb(51,51,51);font-weight:normal;font-style:normal}
div.cls_003{font-family:Arial,serif;font-size:9px;color:rgb(51,51,51);font-weight:normal;font-style:normal}
span.cls_005{font-family:Arial,serif;font-size:8px;color:rgb(51,51,51);font-weight:bold;font-style:normal}
div.cls_005{font-family:Arial,serif;font-size:8px;color:rgb(51,51,51);font-weight:bold;font-style:normal}
-->
<div style="position:absolute;left:314.81px;top:194.39px" class="cls_003">STUDENT while filling your online registration, you will find a</div>
<div style="position:absolute;left:39.65px;top:200.20px" class="cls_003">1</div>
<div style="position:absolute;left:50.18px;top:200.20px">
<span class="cls_005">PRINT this form </span>
<span class="cls_003">. Make sure you print pages 3 and 4 </span>
</div>
this is one of the example xml file.
i need to replace class="cls_003" with corresponding line in the comment for <div> tag
similarly for class="cls_005" in <span> tag, by include style attr instead of class in <span> tag
result should be like,
<div style="position:absolute;left:314.81px;top:194.39px;font-family:Arial,serif;font-size:9px;color:rgb(51,51,51);font-weight:normal;font-style:normal">STUDENT while filling your online registration, you will find a</div>
<div style="position:absolute;left:39.65px;top:200.20px;font-family:Arial,serif;font-size:9px;color:rgb(51,51,51);font-weight:normal;font-style:normal">1</div>
<div style="position:absolute;left:50.18px;top:200.20px">
<span style="font-family:Arial,serif;font-size:8px;color:rgb(51,51,51);font-weight:bold;font-style:normal">PRINT this form </span>
<span style="font-family:Arial,serif;font-size:9px;color:rgb(51,51,51);font-weight:normal;font-style:normal">. Make sure you print pages 3 and 4 </span>
</div>
plz do reply soon with the result using sed or awk
any response will be appreciated...
|
|
|
|
05-04-2009, 01:53 PM
|
#2
|
|
Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,644
|
Quote:
|
STUDENT while filling your online registration, you will find
|
You really ought to do your own homework if you expect to learn anything.
|
|
|
|
05-04-2009, 02:20 PM
|
#3
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
Have you read the documentation for SED and AWK?
|
|
|
|
05-06-2009, 03:01 PM
|
#4
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
24 hours later, it seems that this was really not that urgent for you.
I'm closing this, but please feel free to make a new thread with any more specific questions that come from reading the documentation.
|
|
|
|
| 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 08:48 PM.
|
|
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
|
|