#!/bin/bash
s="B-something
B-something-something
B-something_something
B-something-something_something
I-something
I-something-something
I-something_something
I-something-something_something"
LC_ALL=C sed 's/\([BI]\)-[a-zA-Z_-]\{1,\}/\1/g' <<< "$s"
IyEvYmluL2Jhc2gKcz0iQi1zb21ldGhpbmcKQi1zb21ldGhpbmctc29tZXRoaW5nCkItc29tZXRoaW5nX3NvbWV0aGluZwpCLXNvbWV0aGluZy1zb21ldGhpbmdfc29tZXRoaW5nCkktc29tZXRoaW5nCkktc29tZXRoaW5nLXNvbWV0aGluZwpJLXNvbWV0aGluZ19zb21ldGhpbmcKSS1zb21ldGhpbmctc29tZXRoaW5nX3NvbWV0aGluZyIKTENfQUxMPUMgc2VkICdzL1woW0JJXVwpLVthLXpBLVpfLV1cezEsXH0vXDEvZycgPDw8ICIkcyI=