#!/bin/bash
s='top-level.subpath.one.subpath.two.subpath.forty-five'
sed -E ':a; s/^(.*\.[^.])[^.]+(\.)/\1\2/; ta' <<< "$s"
# => top-level.s.o.s.t.s.forty-five
IyEvYmluL2Jhc2gKcz0ndG9wLWxldmVsLnN1YnBhdGgub25lLnN1YnBhdGgudHdvLnN1YnBhdGguZm9ydHktZml2ZScKc2VkIC1FICc6YTsgcy9eKC4qXC5bXi5dKVteLl0rKFwuKS9cMVwyLzsgdGEnIDw8PCAiJHMiCiMgPT4gdG9wLWxldmVsLnMuby5zLnQucy5mb3J0eS1maXZlCg==