Reputation: 3751
I have files that in-correctly contain
``` Some text ```
and I need to replace the ticks to pre
<pre> Some text </pre>
The trick is, the first pre doest have /
but the seccond pre does.
Upvotes: 0
Views: 40
Reputation: 77155
Using GNU awk
:
$ cat file
``` Some text ```
``` Some
text ```
$ gawk -v RS='```' -v ORS= 'NR>1{$0=(!(NR%2)?"<pre>":"</pre>")$0}1' file
<pre> Some text </pre>
<pre> Some
text </pre>
Upvotes: 2