#!/bin/bash
s='BUG-KEYWORD-BUG-101
ABC-10
DEF-10327
Output is referred in ABC-1043
Please refer DEF-11234'
grep -oE '[[:alpha:]]+-[0-9]+' <<< "$s"