I need to convert multiple markdown code blocks to markdown comment blocks using sed. I want to replace the tags but not the text. (my markdown editor has bad support for comments).
I have:
```FooMore fooEven more foo```
I need to convert this to something like
{>>FooMore fooEven more foo<<}
i.e. syntax used in CriticMarkup.
EDIT: My method. I first replaced all 2nd ocurances with >>}
, then in the new file, replaced all 1st occuranges with {>>
.
For the first step, I used Perl:
perl -e '$count = 0; s/\`\`\`/(++$count % 2 == 0)?">>}":$&/ge;' oldfile.md > newfile.md
to replace every second backtick, using this method.
Then I followed by a simple sed:
sed -i 's/\`\`\`/{>>/g' newfile.md
but backticks are all still there.