I'm in the process of re-structuring my website & have to re-arrange references within files. There is a directory that contains many sub-directories & php files. I'm after some kind of a command/script that can search for each & every file in that directory for this pattern & replace it with a custom pattern.
For Eg: i want to replace exact occurrences of one/two/three/
by /shopping/shop/ipad
. In other words if any file contains some string For Eg:
location:index.php?p=one/two/three/abcdefg&aid
then it should be replaced by
location:index.php?p=/shopping/shop/ipad/abcdefg&aid
Note the content replacement should take place inside every file, in every directory /
sub directory within a main directory (say the main directory name is abc
& all sub directories & files are within abc
). The directory names themselves should not be changed. How can i achieve this ? My server runs linux & i have root & shell access.