I'm having some problems using sed in combination with html. The following sample illustrates the problem:
HTML="<html><body>ENTRY</body><html>"
TABLE="<table></table>"
echo $HTML | sed -e s/ENTRY/$TABLE/
This outputs:
sed: -e expression #1, char 18: unknown option to `s'
If I leave out the /
from $TABLE
so that it becomes <table><table>
it works ok.
Any ideas on how to fix it?
Update
Here's a sample that can reproduce the problem:
template.html:
<html>
<body>
<table>
ENTRIES
</table>
</body>
</html>
gui_template:
<tr>
<td class="td_tut_title">TITLE</td>
<td class="td_tut_content">
<a href="../tutorials/GUI/FILENAME"><img src="img/bbp.png" alt="bbp" /></a>
</td>
</tr>
genhtml.sh:
#!/bin/bash
HTML=`cat template.html`
ENTRIES=`cat gui_template | sed -e s/FILENAME/test/ | sed -e s/TITLE/title/`
DELIM=$'\377'
echo $HTML | sed -e "s${DELIM}ENTRIES${DELIM}$ENTRIES${DELIM}"
Output:
~/svn/byteblower/packages/ByteBlowerCD/htmlgen $ ./genhtml.sh
sed: -e expression #1, char 14: unterminated `s' command