Replace a specific block of data
- From: brian54321uk@xxxxxxxxxxx (Brian)
- Date: Mon, 27 Oct 2008 11:32:06 +0000
Hello again
Not too sure how to pose this question, but here goes.
Working on an html page.
There are many blocks of code placed between <tr> and </tr> in the page.
The block(s) I am playing with have seven lines of code placed between <tr> and </tr>, (repeated a number of times throughout the page) but which have specific differences to all the other blocks. The first being, each line in this block contains the word scope.
The second being, none of the other blocks contain any of the following data between ">" and "<"
line 1 contains >one<
line 2 contains >two<
line 3 contains >three<
line 4 contains >one<
line 5 contains >one<
line 6 contains >six<
line 7 contains >seven<
Using a method along the lines of the example given below, how would I (test and) replace only in this block?
(obviously, the following example changes every single instance, so I know it is totally wrong for the task).
open( F, $ARGV[0] );
while( <F> ) {
s!>one<!>two<!; # line 1
s!>two<!>three<!; # line 2
s!>three<!>four<!; # line 3
s!>one<!>two<!; # line 4
s!>one<!>five<!; # line 5
s!>six<!>twelve<!; # line 6
s!>seven<!>eight<!; # line 7
{
print;
}
}
I can paste a copy of the actual block of code if needed.
thanks
Brian
.
- Follow-Ups:
- Re: Replace a specific block of data
- From: Jay Savage
- Re: Replace a specific block of data
- Prev by Date: RE: problem using mime::lite
- Next by Date: LWP::Simple
- Previous by thread: problem using mime::lite
- Next by thread: Re: Replace a specific block of data
- Index(es):
Relevant Pages
|