XX-XX-XXXXX-ddd-dd-ddddd
is composed of two parts:
XX-XX-XXXXX
is composed of letters, it may contain one or multiple dashes, e.g.abc-de-fghij
, andabcde-fghi-j
.- And
ddd-dd-ddddd
is composed of digits, again, it may contain one or multiple dashes, e.g.123-456-7890
,12-3-456-7890
.
What is an easy way to get the XX-XX-XXXXX
in Bash? For example, suppose I have abc-de-fghij-123-456-7890
, how do I get abc-de-fghij
?