Using sed with html data

Posted by StackedCrooked on Stack Overflow See other posts from Stack Overflow or by StackedCrooked
Published on 2010-05-17T14:20:54Z Indexed on 2010/05/17 14:30 UTC
Read the original article Hit count: 129

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about bash

Related posts about sed