Article 516VF sed: -e expression #1, char 137: unterminated `s' command

sed: -e expression #1, char 137: unterminated `s' command

by
redd9
from LinuxQuestions.org on (#516VF)
Hi everyone, I am very new to using sed and Bash scripting, and created this file to practise:
Code:#!/bin/bash
readarray -d "|" myarray < listOfURLs
for i in "${myarray[@]}"
do
#echo "{$i}"
sed -i "s@URL@$$i@g" HTMLTemplate > filledInHTMLTemplate
doneThe purpose of the code is to read a bunch of URLs from listOfURLs, and replace the text URL in HTMLTemplate with one of the URLs ( a different one each time, iterating through the whole array).

However, I get the error Code:sed: -e expression #1, char 137: unterminated `s' command when I try to run my script. I've tried escaping the sed line in different ways, but nothing helps. Any ideas?

Edit: Also, the HTMLTemplate contains the first URL over and over again replacing the text 'URL'.latest?d=yIl2AUoC8zA latest?i=DZ2LkKxckyw:XRpYqeunOsU:F7zBnMy latest?i=DZ2LkKxckyw:XRpYqeunOsU:V_sGLiP latest?d=qj6IDK7rITs latest?i=DZ2LkKxckyw:XRpYqeunOsU:gIN9vFwDZ2LkKxckyw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments