How to replace string/text in multiple files using sed
The streamline editor (sed) is very useful command for searching and replacing string/texts in multiple files As an example i am going to show you how i have used sed on my Linux web server. I have hundreds of file under a linux directory where i want to search and replace word mysql with mysql in single file intro.html using sed editor
| $ sed -i ‘s/mssql/mysql/g’ intro.html |
In the above command
sed -i is used to for editing the file
-s is used for subsituite the following text/word
-mssql is the word to be replaced by
-myssql is what you would like replace
-g is used for global search, looking for occurrence of text in all the lines in file
To replace word mssql with mysql in multiple files using sed editor run sed like this :
| $ sed -i ‘s/mssql/mysql/g’ *.html |
In Linux and UNIX sed command is available with default installation, However if you are a Micsrosoft Windows user , you can still harness power of sed by installing GNU utilities for Win32
News Tags:
- ,using sed to replace text in multiple files,sed replace string in multiple files,replace string in files,sed replace text in multiple files,sed replace string multiple files,how to use sed to replace text in multiple files,linux replace word in multiple files,sed multiple files,linux sed multiple files,sed to replace string in multiple files,sed replace string in all files,linux replace text in multiple files,use sed to replace text in multiple files,linux replace word in all files,sed replace string,sed stremline editor,replace text in all files using sed
