This isn't really a duplicate as the situation is different with grub2.
We tend to get into a bit of an arms race if we try to edit /etc/default/grub automatically, and so I don't plan to fix this exactly as requested. However, there's a new feature in grub2 which I recommend you use instead: you can write the full name of a menu entry in GRUB_DEFAULT, rather than its number. So instead of GRUB_DEFAULT=6, you could have written something like:
GRUB_DEFAULT='Ubuntu, with Linux 2.6.35-14-generic'
This isn't really a duplicate as the situation is different with grub2.
We tend to get into a bit of an arms race if we try to edit /etc/default/grub automatically, and so I don't plan to fix this exactly as requested. However, there's a new feature in grub2 which I recommend you use instead: you can write the full name of a menu entry in GRUB_DEFAULT, rather than its number. So instead of GRUB_DEFAULT=6, you could have written something like:
GRUB_ DEFAULT= 'Ubuntu, with Linux 2.6.35-14-generic'
This is more descriptive and less error-prone.