sed - Get only the replaced string from a multiline input & omit unmatched lines!
This sed command does what your combination of egrep and sed does:
echo -e "Bla\nBla\nImportant1: One \nBla\nImportant2: Two\nBla\nBla"
| sed -n -e "s/^Important1: *\b\(.*\)\b */\1/p"
You perform the substitution and only print lines that matched, after the substitution.
EDIT: Following was tested on both Mac & Linux.
You can use sed like this:
echo -e "Bla\nBla\nImportant1: One \nBla\nImportant2: Two\nBla\nBla" | \
sed -n 's/^Important1: *\([^ ]*\) */\1/p'
OUTPUT:
one
Explanation
sed -n 's/^Important1: *\([^ ]*\) */\1/p'
-n # quiet / silent
{
s/^Important1: *\([^\ ]*\) */\1/ # replace "Important1: one " with 1st group i.e. "one"
p # print the replaced text
}