I want to replace a sentence in a file this:
from
[Report 1](**Please put link here**)"
[Report 2](**Please put link here**)
to:
[Report 1](https://stackoverflow.com/09004cffcbee784a?docno=/link1)"
[Report 2](https://stackoverflow.com/09004cffcbee784a?docno=/link2)
So I tried with but it does not seem to make the replacement
sed -i 's#[Report 1](\*\*Please put link here\*\*)#(https://stackoverflow.com/09004cffcbee784a?docno=/link1)#g' file.md
>Solution :
Square brackets are special in sed regular expressions (they introduce character classes). You need to escape them by a backslash.
s#\[Report 1\)](\*\*Please put link here\*\*)#(https://stackoverflow.com/09004cffcbee784a?docno=/link1)#g
You may also capture the number after Report and resuse it in the link:
s#\[Report \([12]\)](\*\*Please put link here\*\*)#(https://stackoverflow.com/09004cffcbee784a?docno=/link\1)#g