I guess that the easiest way is to find the concentration of the water in moles per gallon (I prefer moles per mL though, mL is the measure mostly used in my country when it concerns small volumes)
I've got a table
of conversion of SG to ppt, and then from ppm to grams per kilogram.
1.027 : 38.1 ppt at 25 Celsius : 38.1 g/kg
But 1 kg of water is one litre; so 38.1 ppt = 38.1 g/L
Salt is NaCl, mass = 23 + 35.5 = 58.5 g/mol
Therefore, in one litre, we have 0.651 mol/L (concentration of salt) [38.1 / 58.5]
I'll take 5 Litres for the sake of units. 5 litres with concentration 0.651 mol/L
To be reduced to SG of 1.023 : 32.8 ppt : 0.561 mol/L [32.8 / 58.5]
Number of moles you have in 5 Litres of 1.027 = 0.651 * 5 = 3.26 mol
Number of moles you have in 5 Litres of 1.023 = 0.561 * 5 = 2.80 mol
You have to remove (3.26 - 2.80 = ) 0.46 mol of salt.
So, 0.46 mol is found in (0.46 / 0.651 = ) 0.71 L.
Therefore, in this case, you remove 0.71 L from your 5 Litres, and replace it with water to have the desired concentration
Sorry for being late, I got my puter on Sunday (from a week's repair) and had to look for the conversion tables for the SGs.