[plug] sed or awk

Anthony J. Breeds-Taurima tony at cantech.net.au
Mon Jan 15 09:19:08 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?

I don't know if perl is an option:

---
~$ cat a.txt
111111
~$ cat a.pl
while (<>) {
        s/1/++$i/eg;
        print;
}
~$ perl a.pl a.txt
123456
---

HTH

Yours Tony.

/*
 * "The significant problems we face cannot be solved at the
 * same level of thinking we were at when we created them."
 * --Albert Einstein
 */




More information about the plug mailing list