Portal Home > Knowledgebase > Articles Database > Mass replace a word inside files


Mass replace a word inside files




Posted by mylikes786, 11-12-2014, 08:01 AM
In my one cpanel account there is 100s of php file. i want to replace a word in all file to Is there any way i can do this??

Posted by xgenHosting, 11-12-2014, 08:11 AM
Simply copy the content of the file, paste it in new text file on your system and then open the file using an application like notepad++ then use the search and replace function of notepad++ search for the term "Example" and replace it with "New Word". Thats all. If you need it to be done on a linux machine with just SSH access reply back and I will post a solution for that too. I guess you just need it for windows and I am too lazy to type for linux if u dont need it <> Last edited by bear; 11-12-2014 at 09:03 AM.

Posted by mylikes786, 11-12-2014, 09:08 AM
Notepad will not work. because there is 1000s of file and not possible to open one by one and replace word. I want some difrrent solution

Posted by TempleNode, 11-12-2014, 09:09 AM
It will replace word Example with New Word in all php files

Posted by xgenHosting, 11-12-2014, 10:59 AM
If your files are on a linux server and you can SSH into it try this Login using your SSH credintials and follow these steps. They were meant to clean base64 code just edit it to suit your needs by replacing the search query $ find . -type f | xargs grep “dGhpcyBpcyBhIHRlc3Q=” This command will search for all files in the current folder that contain the following string: “dGhpcyBpcyBhIHRlc3Q=”. Here is how the output of that command will look like: ./themes/default/single.php:

Posted by Srv24x7, 11-12-2014, 10:59 AM
Hi, Before trying this bulk change, make sure you are have tested this properly on a single file. sed -i 's/old_word/new_word/g' File.php Try the above for one file and then check if it is as you expected because you don't want to be in a situation of getting things messed up.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Will this work? (Views: 742)


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.