I often find this in scripts (and, I have to admit, write it myself):
a=`echo $x | sed "s/foo/bar/"`
if echo $x | grep foo then ... fi
Consider "foo" to include some regex stuff.
I feel that there should be - and most likely is - a better way to phrase this, one that does not involve two commands and a pipe but wraps the thing into some more compact expression.
I just can't find it. Anybody?