Suppose an input.txt file that contains several strings as the following ones:
[[foo>a|a]]
[[foo>b|b]]
[[foo>c|c]]
that I'd like to replace by:
:foo:`a`
:foo:`b`
:foo:`c`
I guess I could manage to achieve this result with sed or rg (I never used awk).
But this file also contains other strings as the following ones:
[[foo>a|d]]
[[foo>b|e]]
[[foo>c|f]]
that I'd like to replace by:
:foo:`d <a>`
:foo:`e <b> `
:foo:`f <c>`
All my attempts failed because I don't see how to handle two different patterns at once.
Do you know some ways to achieve the latter result (and, BTW, the former)?
$1,$2, etc. with Perl,\1,\2, with sed).