[plug] sed or awk
Mike Holland
myk at golden.wattle.id.au
Sun Jan 14 22:16:22 WST 2001
On Sun, 14 Jan 2001, Rob Dunne wrote:
>
> Hi List,
> can anyone tell me how to replace repeated occurances of
> that same pattern with a different replacement pattern?
Within a line? A file? How about this (perl) approach:
s/1(.*?)1(.*?)1/1${1}2{$2}3/g
> ie
> the first "1" is replaced with "1"
> the second "1" is replaced with "2"
> the third "1" is replaced with "3"
>
>
--
Mike Holland <mike at golden.wattle.id.au>
--==--
If you're not part of the solution, you're part of the precipitate.
More information about the plug
mailing list