I need to replace a character on file portions matching a certain regexp. To be precise, I need to remove spaces with
- in ill-formed markdown links, e.g.:
[This is my link](actual bad link.md)
[This is my link](actual-bad-link.md)
I can match something that begins with
( and ends with
.md) with a regexp in sed, but then I don't know how to tell sed to replace only the spaces in the matched expression. Is there a way to do this (possibly also with another command line tool like e.g. awk)?
Edit: to be minimal, I'd be happy with any command that replaces all the spaces between