Find and replace with sed in directory and sub directories

I run this command to find and replace all occurrences of ‘apple’ with ‘orange’ in all files in root of my site: find ./ -exec sed -i ‘s/apple/orange/g’ {} \; But it doesn’t go through sub directories. What is wrong with this command? Here are some lines of output of find ./: ./index.php ./header.php ./fpd … Read more

Shell script – remove first and last quote (“) from a variable

Below is the snippet of a shell script from a larger script. It removes the quotes from the string that is held by a variable. I am doing it using sed, but is it efficient? If not, then what is the efficient way? #!/bin/sh opt=”\”html\\test\\\”” temp=`echo $opt | sed ‘s/.\(.*\)/\1/’ | sed ‘s/\(.*\)./\1/’` echo $temp … Read more