I do a massive search and replace in php files with this command:

find -type f -name \*.php | xargs sed -i 's|что заменить|чем заменить|' 

Tell me how to do it, so that he would not search in all folders, but only in those whose names are listed in the text file list.txt .

Contents of the list.txt file:

 foldername1 foldername2 foldername3 и тд. 

Search and replace in these folders must be done recursively.

Thank.

    1 answer 1

    The positional parameters of the find (1) utility specify the names of the directories where to start the search. By default, the GNU version searches in the current directory. To pass folder names to find parameters, do this:

     find `cat list.txt` -type f -name \*.php | .... 

    True, this will work if there are no spaces in the names of your directories.