Regexp hints

echo "bla bla word word1 = string1 string2" | sed -e 's/.* \([^ ]*\)=.*/\1/g'

Some basic regexp hints:

the first /…/ is what your string should match

s means substitute/replace

the last /…/ is the replacement

g means global, replace all occurrences

a . will match any ONE character

* means 0 or more, so .* means 0 or more of any characters

any character matches itself, so the space will match a space

\(…\) means capture everything in between and assign it a group
number, this will be group 1 as you will see in the replacement part as \1

[…] will match any ONE of the characters inside, if it starts with ^
then it will match anything not in the set. So [^ ]* will match a word
(as it will match as many characters it can not containing a space).

So to match a word after = you will have to move around the group which
matches a word. The actual regexp is left as an exercises of course.

For more references: “”