I am replacing the below file (sample.txt):

with:
{{< image alt="top command output linux" src="/images/post/wp-content-uploads-2022-04-top-command-output-linux.jpg" >}}
Also, I need to do an inline file replacement. Here is what I have done:
sed -i -e 's/^!\[/\{\{< image alt="/g' sample.txt
Output:
{{< image alt="top command output linux](./img/wp-content-uploads-2022-04-top-command-output-linux.jpg)
But when I try to replace ](./img with " src="/images/post, I am getting errors. I have tried below, but it does not change anything:
sed -i -e 's/^!\[/\{\{< image alt="/g' -e 's/\]\\(.\/img/\" src=\"\/images\/post/g' sample.txt
So basically the problem is with the 2nd substitution:
's/\]\\(.\/img/\" src=\"\/images\/post/g'