in reply to Repeating a substitution
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).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Repeating a substitution
by ikegami (Patriarch) on Jan 09, 2018 at 18:12 UTC | |
by Eily (Monsignor) on Jan 09, 2018 at 18:15 UTC |