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'.


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'.