I had to change the svga.vramsize paramter across multiple vmx files on multiple datastores.

So here is how i got it done:

SAVEIFS=$IFS  
IFS=$(echo -en "\n\b")  
for i in `grep -l -i ‘svga.vramSize = "40968192"’ /vmfs/volumes/*/*/*.vmx`  
do  
echo Filename:$i  
echo Backing up VMX...  
cp $i $i.bak  
echo Backup complete...  
echo Current Parameter:  
grep -i svga.vramsize $i  
echo Updating VMX...  
sed -i 's/svga.vramSize = "40968192"/svga.vramSize = "31457280"/g' $i  
echo Update done...  
echo New Parameter:  
grep -i svga.vramSize $i  
read -p "Hit any key to continue..."  
done  
IFS=$SAVEIFS  

So, what does the script do?

  1. Searches the .vmx file for the specified svga.vramSize parameter
  2. Backups up the .vmx file
  3. Replaces the parameter in the .vmx file

The above script can be used to change other parameters in the .vmx file too.