Given a string such as `abc-def-ghi-jkl`.  

Can the `sed` command extract the substring to the left of the nth separator character such as `abc` for 1, `abd-def` for 2 etc?

I need it for making creating files based on a subset of the computers hostname, normally `abc-def-xyz.domain.com`.

Having looked around it appears that `awk`, `cut` and `sed` are combined in this kind of extractions but I prefer something that can be used as part of a command line.