It may also be helpful to note that the only difference in the regex part is the difference between Basic Regular Expression (BRE) and Extended Regular Expressions (ERE).
BRE (+GNU)
printf "%s\n" foo bar baz food | grep '\<\(fo\+\|bar\)\>'
printf "%s\n" foo bar baz food | sed -n '/\<\(fo\+\|bar\)\>/p'
ERE (+GNU)
printf "%s\n" foo bar baz food | grep -E '\<(fo+|bar)\>'
printf "%s\n" foo bar baz food | sed -nr '/\<(fo+|bar)\>/p'
printf "%s\n" foo bar baz food | awk '/\<(fo+|bar)\>/'
I left out the -o
with grep above.
It may be also good to note that all examples above are with GNU utilities with GNU extensions to POSIX regular expressions.
All examples are using the GNU extension :
\< ... \>
And in addition the BRE examples are using the GNU extension:
\+
Which will probably not work if used with other versions of these utilities..