Use sed to Replace Anchor Tags

Convert links to markdown

Refer: https://digitalsanctum.com/2020/09/10/how-to-replace-html-links-with-markdown-links/

cat anchor-tag.html | sed -r 's/<a[^>]*href="([^"]*)[^>]*>([^<]*)[^>]*>/[\2](\1)/g'

This:

Refer to this: <a href="https://mruckman.com">link</a>

Changes to This:

Refer to this: [link](https://mruckman.com)

Use this command to convert ALL href tags into underline tags, this includes mailto links

cat anchor-tag.html | sed -r 's/<a[^>]*href="([^"]*)[^>]*>([^<]*)[^>]*>/\<u\>\2\<\/u\>/g'

This:

Refer to this: <a href="https://mruckman.com">link</a>

Changes to This:

Refer to this: <u>link</u>