Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Changing Text with sed or awk Post 302504498 by hal8000 on Monday 14th of March 2011 06:44:37 PM
Old 03-14-2011
Changing Text with sed or awk

I'm changing some html code on multiple web pages and I need to match particular phrases but keep some text within each phrase.

E.G. I need to change this line:

<DIV id="heading">Description:</DIV>

into

<span class="hlred">Description:</span><br />


The text "Description:" may change and sometimes occurs more than once. I am using a for loop to run the script several times.

I can't "grep" description because this may change, however "heading" is consistent but its getting rid of final
</DIV> and keeping the text that is eluding me.
Hope the example is clear, thanks in advance for any help with this.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing text with sed?

Hi everyone, Having trouble with sed. I searched the board and found some stuff, but still unclear. I have a file named "userfile" which stores the users info in this form: email:username:password: I want the user to be able to change their password. i tried with sed s/oldpass/newpass/g... (2 Replies)
Discussion started by: primal
2 Replies

2. Shell Programming and Scripting

text processing ( sed/awk)

hi.. I have a file having record on in 1 line.... I want every 400 characters in a new line... means in 1st line 1-400 in 2nd line - 401-800 etc pl help. (12 Replies)
Discussion started by: clx
12 Replies

3. Shell Programming and Scripting

text transformation with sed or awk

Hi there, I'm trying to extract automatically opening hours from a website. The page displaying the schedules is http://www.natureetdecouvertes.com/pages/gener/view_FO_STORE_corgen.asp?mag_cod=xxx with xxx going from 101 to 174 I managed to get the following output : le lundi de 10.30 à... (4 Replies)
Discussion started by: chebarbudo
4 Replies

4. Shell Programming and Scripting

sed or awk to parse this text

I am just beginning with sed and awk and understand that they are "per" line input. That is, they operate on each line individually, and output based on rules, etc. But I have multi-line text blocks that looks as follows, and wish to ONLY extract the text between the first hyphen (-) and the... (13 Replies)
Discussion started by: bulgin
13 Replies

5. Shell Programming and Scripting

changing files content with sed or awk

Hi, Example File: (jumped, bumped, ) how to jumped, FROM tree; EXIT I have some hundreads of files like this with the different words and I want to remove the comma before the bracket and also I have to remove the comma before FROM word. I am trying to use this command : awk '... (5 Replies)
Discussion started by: rajshashi
5 Replies

6. Shell Programming and Scripting

sed/awk changing values

Can somebody help me out and provide me with a SED or AWK solution that converts TO_DATE CLAUSE -> TIMESTAMP I need to keep the PARTION value (HISTORY_20110417) and DATE/TIME value (2011-04-18 00:00:00) the same for every line PARTITION HISTORY_20110417 VALUES LESS THAN (TO_DATE('... (3 Replies)
Discussion started by: BeefStu
3 Replies

7. UNIX for Advanced & Expert Users

Need help either with awk or sed to get text between words

Hello All, My requirement is to get test between two words START & END, something like html tags Eg. Input file: START Line1 Line2 Line3 CLOSE START Line4 Line5 Line6 END START Line7 START Line8 (7 Replies)
Discussion started by: konerusuneel
7 Replies

8. Debian

Using awk and sed to replace text

Good Day Every one I have a problem finding and replacing text in some large files that will take a long time to manually edit. Example text file looks like this #Example Large Text File unix linux dos squid bind dance bike car plane What im trying to do is to edit all the... (4 Replies)
Discussion started by: linuxjunkie
4 Replies

9. Shell Programming and Scripting

awk or sed? rows text to co

Hello Friends! I would like to help the masters ... I have a file with the entry below and would like a script for that output: Input file: 001 1 01-20152142711532-24S 1637909825/05/2015BAHIA SERVICOS R F, ... (1 Reply)
Discussion started by: He2
1 Replies

10. Shell Programming and Scripting

Text replacement with awk or sed?

Hi guys, I worked for almost a half-day for the replacement of some text automatically with script. But no success. The problem is I have hundred of files, which need to be replaced with some new text. It's a painful work to work manually and it's so easy to do it wrong. For example, I... (2 Replies)
Discussion started by: liuzhencc
2 Replies
CAIRO_PATTERN_ADD_COLOR_STOP_RGBA(3)					 1				      CAIRO_PATTERN_ADD_COLOR_STOP_RGBA(3)

cairo_pattern_add_color_stop_rgba - Description

SYNOPSIS
void cairo_pattern_add_color_stop_rgba (CairoGradientPattern $pattern, float $offset, float $red, float $green, float $blue, float $alpha) DESCRIPTION
The function description goes here. Warning This function is currently not documented; only its argument list is available. PARAMETERS
o $pattern - Description... o $offset - Description... o $red - Description... o $green - Description... o $blue - Description... o $alpha - Description... RETURN VALUES
What is returned on success and failure ERRORS
/EXCEPTIONS When does this function issue E_* level errors, and/or throw exceptions. EXAMPLES
Example #1 cairo_pattern_add_color_stop_rgba(3) example Any text that describes the purpose of the example, or what goes on in the example should be here. <?php /* ... */ ?> The above example will output something similar to: SEE ALSO
related-function-name-here(3). PHP Documentation Group CAIRO_PATTERN_ADD_COLOR_STOP_RGBA(3)
All times are GMT -4. The time now is 08:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy