Newed a little help on using sed to insert html
Hi All
I am trying to run a simple sed one liner, but just cannot get it right no matter where i look. I ned to insert a single line of html into index.php in place. The line would be: <a id="goog" href="#" onClick="window.open('test.php','iframe')">test this edit</a> My one liner is: sed -i '209 a\\<a id=\"goog\" href=\"#\" onClick=\"window.open(\'test.php\',\'iframe\')\"\>test this edit\<\/a\>' /var/www/html/index.php I get: syntax error near inexpected token. It looks to me like everything is escaped a OK, but i just cannot find the issue and its driving me mad. Anyone able to point out what i expect is an obvious mistake I am just missing? Thanks! |
Hi
Try Code:
sed -i "209a <a id=\"goog\" href=\"#\" onClick=\"window.est.php\',\'iframe\')\"\>test this edit\<\/a\>" /var/www/html/index.php indiajoe |
Thanks
That was almost there, but it pointed be perfectly in the correct direction, thank you so much. For others, I needed a preceeding escape slash in the previous post to get it running: sed -i "209a \<a id=\"goog\" href=\"#\" onClick=\"window.open(\'test.php\',\'iframe\')\"\>Tester\<\/a\>" /var/www/html/index.php Again, many thanks |
All times are GMT -5. The time now is 11:58 PM. |