You asked for a command to remove all occurrences of a string in multiple files, so here it is:
find /home/xxx/public_html -type f -exec sed -i 's/themefie\.com//g' {} \;
If you want to replace this string with something else:
find /home/xxx/public_html -type f -exec sed -i 's/themefie\.com/SOMETHING_ELSE/g' {} \;
You can back up the files like this (will add .bak
extension to all modified files):
find /home/xxx/public_html -type f -exec sed -i.bak 's/themefie\.com/SOMETHING_ELSE/g' {} \;
However, this is a very brutal method, and you will very probably break many things issuing this command.
If you can change your theme for something else, then you should probably go this way.
Whatever happens, don't forget to back up your data before running any of these commands.
As suggested by @Stephen Kitt in the comments, you can use find
in a different way, which is more optimized while processing multiple files using sed
.
Quote from the find
man page:
-exec command ;
Execute command; true if 0 status is returned. All following arguments to find are taken to be arguments to the command until an argument
consisting of `;' is encountered. The string `{}' is replaced by the current file name being processed everywhere it occurs in the argu‐
ments to the command, not just in arguments where it is alone, as in some versions of find. Both of these constructions might need to be
escaped (with a `\') or quoted to protect them from expansion by the shell. See the EXAMPLES section for examples of the use of the -exec
option. The specified command is run once for each matched file. The command is executed in the starting directory. There are unavoid‐
able security problems surrounding use of the -exec action; you should use the -execdir option instead.
-exec command {} +
This variant of the -exec action runs the specified command on the selected files, but the command line is built by appending each se‐
lected file name at the end; the total number of invocations of the command will be much less than the number of matched files. The com‐
mand line is built in much the same way that xargs builds its command lines. Only one instance of `{}' is allowed within the command, and
it must appear at the end, immediately before the `+'; it needs to be escaped (with a `\') or quoted to protect it from interpretation by
the shell. The command is executed in the starting directory. If any invocation with the `+' form returns a non-zero value as exit sta‐
tus, then find returns a non-zero exit status. If find encounters an error, this can sometimes cause an immediate exit, so some pending
commands may not be run at all. For this reason -exec my-command ... {} + -quit may not result in my-command actually being run. This
variant of -exec always returns true.
So this will give you:
find /home/xxx/public_html -type f -exec sed -i 's/themefie\.com/SOMETHING_ELSE/g' {} \+
themefie.com
to something else in anyurl
key in the JSON file and in anyguid
node in the XML file".themefie.com
is inside html/php/sql/json etc . when i use grep "themefie.com" its showing a lot kind of files has this work , i want to remove this word or replace it with anything else no matter the file extenstion