Description
We want to replace each of the first four occurrences of word
with six dashes.
|
| Raw Input
|
| Desired Output
| word_1
much more data...
word_2 word_3
much more data...
word_4 word_5
word_6
much more data...
word_7 final word_8
|
| ------_1
much more data...
------_2 ------_3
much more data...
------_4 word_5
word_6
much more data...
word_7 final word_8
|
|
Script and Comments
Script1 [ 1] /word/!b
[ 2] :0
[ 3] $!{
[ 4] N
[ 5] /(word.*){4}/!b 0
[ 6] }
[ 7] :1
[ 8] s/word/------/
[ 9] x
[10] s/^/\n/
[11] /\n{4}/!{
[12] x
[13] /word/b 1
[14] b 2
[15] }
[16] x
[17] :2
[18] n
[19] b 2
| |