Convertig HTML links to MD links across all notes

Hey guys, I’d really appreciate some help solving an issue that came up when migrating my markdown notes from Bear to Joplin to Obsidian. Basically, I ended up with 1,700+ markdown files that contain links to local attachments in this format:

<a href='Water%20boilerheater%20manual/English%20Instructions%20for%20Thermostat.pdf'>English Instructions for Thermostat.pdf</a>

However, for the links to work properly in Obsdidian, the format should be this:

![[attachments/Water boilerheater manual/English Instructions for Thermostat.pdf]]

Is there a bash script or series of commands I can run to go through these files and correct these links?

I’ve tried all kinds of plugins and other tools and nothing seems to work.

Thank you!