#!/bin/sh
for file in "$@"
do
ext=${file##*.}
base=${file%.*}
num=${base##*v}
zeroes=${num%%[!0]*}
num=${num#$zeroes} #remove leading zeros, or it uses octal
num=$((num+1))
base=${base%v*}
new=$(printf '%sv%04d.%s' "$base" "$num" "$ext")
cp -nv "$file" "$new"
done
Now I need it to work with a file that has two characters after the version number.
098_FGT_550_comp_v002gp.nk
I've tried just about everything I know to get this to work but it seems the characters get picked up as part of the number.