On Mon, 2007-04-23 at 11:41 +0200, Dario Lesca wrote: > Hi, how to found into string 2 or more word, only if are all present? > > % echo "aa bb cc dd"|egrep -q '(bb|dd)' && echo found > > This command show "found" if bb OR dd are in string. > But if I want show "found" only if bb AND dd are present into string. > > What egrep (or sed) command I must use? will you accept perl? I'm sure this could be neater, but I'm a bit rusty: echo "aa bb cc dd" | perl -pe 'exit(!(/(?=.*bb)(?=.*aa)/));' && echo found Matt Matt Davey When I read about the evils of drinking, I gave mcdavey@xxxxxxxxxxxxxx up reading. - Henny Youngman.