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... |
Quote:
|
Have you read the documentation for SED and AWK?
|
Quote:
I'm closing this, but please feel free to make a new thread with any more specific questions that come from reading the documentation. |
All times are GMT -5. The time now is 09:43 AM. |