If the right side of the substitution is constant, split works well, even if the replacement contains the initial value (eg, turn the 10 first | into ||) perl -nE 'print join q(||o||), split q(:), $_, 3' file (as posted on stackoverflow).
In reply to Re: Repeating a substitution
by Eily
in thread Repeating a substitution
by choroba
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |