Sample Header Ad - 728x90

Modify URL in markdown link

2 votes
3 answers
817 views
I'm trying to modify a markdown file. In a file, there are many links like this one.
[string one](/stringtwo/#stringthree)
I'd like to change these to the following:
[string one](stringtwo.html#stringthree)
Remove slashes and add .html. I tried the following:
sed -i 's/](\(\/.*\)#/](\1.html#/g' file
But it returns [global configuration](/config/.html#globals). It doesn't remove slashes. How can I achieve this using bash or sed?
Asked by shin (759 rep)
Nov 18, 2022, 03:48 AM
Last activity: Nov 18, 2022, 05:21 PM