# Linux – replacing dot in string, but leaving last one

linux

replace the "." [dots], but leave the last one: e.g.: .txt [there could be random number of dots in the string, even zero, i just need the last one]

$echo 'someth.ing.something.txt' | SOMEMAGIC someth-ing-something.txt$

echo 'someth.ing.something.txt' | sed 's/$$.*$$\.$$[^.]*$$\$/\1\n\2/;s/\./-/g;s/\n/./g'