replacing dot in string, but leaving last one
Give this a try:
echo 'someth.ing.something.txt' | sed 's/\(.*\)\.\([^.]*\)$/\1\n\2/;s/\./-/g;s/\n/./g'
#!/bin/bash
F=$1
tail=${F#*.}
head=${F%.*}
removed_dots=$(echo $head| tr "." "-")
mv -iv $1 "$removed_dots.$tail"