s/\w-(\w+)-.*/$1/ needs to be quoted with a ' (single quote) on each side of the expression:
's/\w-(\w+)-.*/$1/' should work. Except that we are using sed, not perl. So something closer to what you need is:
Bash is parsing your sed expression and hence the error prefix of "-bash: command substitution:" . You need to escape it out with the single quotes or escape every meta character with a back slash. Plus sed looks for \( and \1 after it has been escaped, not perlre's ( and $1 repectively.
Hope this helps,
PS I have been corrupted by perl. Use the available tool you are most familiar with.
PPS Does anyone know of a sed script to convert perl regexs to sed? Cause that would be cool.