My goal is to convert a NEWS format (the output of appstream-util appdata-to-news
) to a markdown format (to use on GitHub/GitLab).
A good approximation for me would be to just go from this:
Version 0.5.1
~~~~~~~~~~~~~
Released: 2019-01-03
* This is a test with a ~ tilde ~~~~
* Second line
to this
Version 0.5.1
=============
Released: 2019-01-03
* This is a test with a ~ tilde ~~~~
* Second line
But my current solution with tr '~' '='
gives me this:
Version 0.5.1
=============
Released: 2019-01-03
* This is a test with a = tilde ====
* Second line
The regex to find all the lines containing only ~
should be this: ^~*$
But how can, with bash/sed/awk, replace with the same amount of =
?