In this post I would like to replace all <embed> HTML tags in a HTML file with a <strong> tag.
# sed -e 's/<embed[^>]*>/<strong>/g' filename.html > newfile.html
And if you would like to remove the <embed> tag altogether
# sed -e 's/<embed[^>]*>//g' filename.html > newfile.html
To remove all HTML tags in a file
# sed -e 's/<[^>]*>//g' filename.html > newfile.html
The result file newfile.html is now without any < HTML tags >.
Tags: html, regexp, replace, sed
Posted by Hans-Henry Jakobsen
Different ways of replacing text etc.
Replace every occurrence of pattern1 (pat1) with pat2
:g/pat1/s//pat2/g
Replace every occurence of pattern1 (pat1) with a newline
:g/pat1/s//\r/g
In practice this inserts a newline after every occurence of pat1.
Posted by Hans-Henry Jakobsen
UPDATE ´tablename´ set field = replace(field, ’searchString’, ‘replaceString’);
Tags: Database, MySQL, replace, search
Posted by Hans-Henry Jakobsen