Categories
Scripts SSH www

Linux replace command all files with sed shell command

Replace word in all files with sed via linux shell command

To replace string design/nashik to designing/india on the same file textNashik.html
Use the following linux command with the syntax.
sed -i s:design/nashik:designing/india:g textNashik.html

Another Example:
sed -i s:twitter.com/webservices:twitter.com/dnswspl:g home/*.html

Replacing phrase in all files including directories and subdirectories using sed and find

find . -type f -exec sed -i ‘s:ecommerce.html:ecommerce-shopping-cart.html:g’ *.html {} \;

NOTE: ‘:’ used as a substitue for ‘/’ as / is used in search and replace.

Related: Linux Command, Shell Command, Sed Command, Replace Text, Linux Replace