Write a command to change all and in file foohtml to and re

Write a command to change all <B> and </B> in file foo.html to <STRONG> and </STRONG>, respectively in unix.

Solution

sed -i \'s#<b>#<strong>#g; s#</b>#</strong>#g\' foo.html

sed is used for search and replace in unix.

-i option is for replacing inplace

g option is for replacing globally all the occurences in the file instead of only first occurence

\'s#findstring#replacestring#g\' means seach for \'findstring\' string and replace it with \"replacestring\" string globally

Write a command to change all <B> and </B> in file foo.html to <STRONG> and </STRONG>, respectively in unix.Solutionsed -i \'s#<b>

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site