First of all, let me say "I understand". Specifically, the need to head off suggestions before they come. There will be the inevitable "you should use bash" and "perl could do it easy" and other similar comments. I hate that, and I try to put in as much "encouragement" in my questions to stop them from coming
if they aren't acceptable solutions.
I won't mention any of those types of responses
There is another thread a few days back that touched on this. Here's the
link. The post is about a bash script, but a reply further down gives a solution using sed. That's why I'm linking to it.
The thread also brings up another point you did not elaborate on: what do
you consider to be an extension? any and all text following the
first period, any and all text following the
last period, or something else? The sed command will change depending on your definition.