Given the text example:
.... text ,.. {{{python string1 = 'abcde' string2 = '12345' print(string1[[1:3]]) print(string2[[:-1]]) }}} .... text ,..
The [[
and ]]
also appear outside of {{{
too. Maybe there are spaces and tabs before {{{ and }}}.
I want to substitute all [[
and ]]
into [
and ]
between {{{
and }}}
.
I need to write the result back to original file.
How can I do this? Will sed
or awk
work?
awk '/[{]{3}/,/[}]{3}/ { gsub(...)) }' file
. But I still can not solve this problem.