OT: simple regex question

Cameron Simpson cs at zip.com.au
Thu Apr 26 08:24:16 UTC 2007


On 23Apr2007 11:41, Dario Lesca <d.lesca at solinos.it> 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?

echo "aa bb cc dd" | sed -n '/bb/{/dd/p}'

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

What are politicians going to tell people when the Constitution is gone and
we still have a drug problem?   - William Simpson, ACLU




More information about the fedora-list mailing list