I'm trying to write a bash script that takes a few variables and then does a find/replace with a given file search using grep to get the list of files that have the string. I think the issue I'm having is having the variables be seen in sed I'm not sure what else it might be.
if [ "$searchFiles" != "" -a "$oldString" != "" -a "$newString" != "" ]; then
echo -en "Searching for '$searchFiles' and replacing '$oldString' with '$newString'.\n"
for i in `grep $oldString $searchFiles |cut -d: -f1|uniq`; do
sed -i 's/${oldString}/${newString}/g' $i;
done
echo -en "Done.\n"
else
usage
fi