Hello friendly computing people,
This is a two part question. I'm writing two shell scripts with the goal of doing a 'find and replace' in all the index.php files in a folder and its subfolders.
The first shell script is this:
echo "running on all directories…"
find . -name '*.php' -exec ./search_replace.sh {} \;
which then runs the file search_replace :
echo "running search and replace script..."
sed -e 's/http:\/\/ericbrotto.com/file:\/\/\/Users\/ericbrotto\/Documents\/Portfolio_CV_etc.\/Offline_Portfolio/g' index.php > index.htm
My problems/questions are these:
When I run the first script it echos "running search and replace script..." 13 times which makes sense because there are 13 index.php files in the folders. But the result is that only one file is completed i.e. the words are replaced and an new htm file is created only once.
Is there anyway to do this so that instead of creating a new .htm file based on the .php file, I can just have the same index.php file with the words replaced? In other words can they edit the file without having to create a new one.
Thanks so much,