split string help

could anyone help in running split cmd

split("String1,outputArray,"delimiter);
with sample script?.

for eg i have abc-def-ghi-sdf-

my ultimate aim of asking this is i have a string containing hypens,
i want to get the string before last n(2) Hypens

Could you give an example of the string and how you want it to look finally.

echo 'abc-def-ghi-sdf-' | nawk -F- -v OFS=- -v num=2 '{NF-=num; $1=$1; print}'

i get ksh: nawk: not found error. i am using sunOS v5.8

tried locating '/usr/bin/nawk' and/or '/usr/xpg4/bin/awk' ?