Bash and seq, 132 bytes
b(){ echo -n "|";for i in $(seq 3 $1);do echo -n "$2";done;echo "|";} r(){ b $1 "-";for i in $(seq 3 $2);do b $1 " ";done;b $1 "-";} Use calling r, like r 8 4:
|------| | | | | |------| b(){ echo -n "|";for i in $(seq 3 $1);do echo -n "$2";done;echo "|";} r(){ b $1 "-";for i in $(seq 3 $2);do b $1 " ";done;b $1 "-";} Use calling r, like r 8 4:
|------| | | | | |------|