fork download
  1. #!/bin/bash
  2. s='top-level.subpath.one.subpath.two.subpath.forty-five'
  3. sed -E ':a; s/^(.*\.[^.])[^.]+(\.)/\1\2/; ta' <<< "$s"
  4. # => top-level.s.o.s.t.s.forty-five
  5.  
Success #stdin #stdout 0.01s 5660KB
stdin
Standard input is empty
stdout
top-level.s.o.s.t.s.forty-five