Oops, time ran out for editing. Turns out there may be an entirely different alternative solution if your main concern is g###. That was a rhetorical statement. If you can bring yourself to sign up for Google Webmaster Tools, there's a section on "URL parameters" under "site configuration". (Found it while looking for something else, naturally.)
Only use this feature if you feel confident about how parameters work for your site. Telling Googlebot to exclude URLs with certain parameters could result in large numbers of your pages disappearing from our index.
So if you want "large numbers of your pages disappearing from our index" this would seem to be just the ticket :)