2
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?
Is there any text outside these delimiters? Anything else? – slhck – 2012-05-30T12:44:55.993
Yes, there are text outside of those delimiters. – stardiviner – 2012-05-30T14:56:01.157
I found a little hints:
awk '/[{]{3}/,/[}]{3}/ { gsub(...)) }' file
. But I still can not solve this problem. – stardiviner – 2012-05-30T15:28:44.423