I have two lines as follows in my file.
<start>start of program<end>
<start>string to be replaced<end>
These lines are in the middle. There are blank spaces before the promt <. The sentence 'string to be replaced' need to be replaced by the sentence 'changed'.
The sentences 'string to be replaced is not always the same.
So i would like to delete the line 'string to be replaced and add my new sentence 'changed'.
I have tried the code,
Expand|Select|Wrap|Line Numbers
- while (<IN>){
- my $file = $_;
- if ($file =~ /\start of program/){
- print OUT $file;
- $file=<IN>;
- }
- $file =~ s/ /changed/g;
- }
Ramesh