I'm assuming the ordering of the definitions isn't important. If that's the case, I'd have two files, one containing ALL definitions possibly needing replacing, and then have another file with the ones you want. Strip out everything, than append the ones you want:
Code:
ALLDEFS=`cat all_possible_defs.db`
NEWDEFS=`cat names.db`
for x in $ALLDEFS
do
PreprocessorDefinitions=`echo "$PreprocessorDefinitions" \
| sed "s/$x\;//"`
done
for x in $NEWDEFS
do
PreprocessorDefinitions="$PreprocessorDefinitions$x\;"
done
This way you don't have to worry about 'cutting' things out you might be unable to replace. Not sure if it's what you want though.