Sample Header Ad - 728x90

How to remove markdown links from headers with sed?

-1 votes
3 answers
63 views
I'm trying to use sed to remove links like and leave just the title:
## [Some title](#some-title)
This is my command:
sed 's/^\(\#*\) *\[\([^\]]*\)\].*/\1 \2/'
I expect to have just the text without the link:
## Some title
But it doesn't work. What I do wrong? I'm using Linux with GNU sed.
Asked by jcubic (10310 rep)
Jul 17, 2025, 11:35 PM
Last activity: Jul 19, 2025, 06:22 AM