#!/bin/bash

if [ $# -ne 2 ]; then
  echo "Usage:  `basename $0` <nnnn> <ext>" 1>&2
  exit 1
fi

num=$1

for old in *.$2
do
  if [ -f $old ]
  then
    ext=`echo $old | tr . \\\\012 | tail -1`
    mv -i $old `echo $num $ext | \
	awk '{ printf "%03d.%s",$1,$2 }'`
    num=$[$num+2]
   fi    
done
