in reply to Find & Replace
Sridhar, Here is one way to do it.
use strict; use warnings; my $string = 'Hello,World,23,,,, test,test,test test,test,test test,test,test test,test,test end,bye,,,,'; $string =~ s/((?:first line last word|last line last word),)[^\n]*/$1/ +g; #in your file $string =~ s/((?:23|bye),)[^\n]*/$1/g; #here in this string print $string;
update:Oops! Already two answers above me. Better solutions from davorg++ and McDarren++
Prasad
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Find & Replace
by mantra2006 (Hermit) on Aug 10, 2006 at 14:58 UTC | |
by McDarren (Abbot) on Aug 10, 2006 at 15:08 UTC | |
by mantra2006 (Hermit) on Aug 10, 2006 at 15:19 UTC | |
by mantra2006 (Hermit) on Aug 10, 2006 at 17:45 UTC | |
by mantra2006 (Hermit) on Aug 10, 2006 at 17:20 UTC |