I'm trying to find the set of words (if any) that contain two consecutive es, and also contains two ys. But so far I tried following commands ,grep -e '[y&y].*[ee]' -e '[y&y].*[ee]' words2.txt grep -e 'y.y' -e 'ee' words2.txtgrep -X '.*[y.y].*&.*[ee].*' words2.txt grep -X '.[*y.y].*&.[*ee].*' words2.txtsome of these commands gives either two y's or two consecutive e's, but don't give a word that contains both of these conditions. What should I do now?
Need a hand with grep+regex
grep;osx;regular expression
I'm assuming your file looks something like this:beeyy yeey open iee eey yeefyfunny reenydy jyyeeand is called words2.txt.  Yes, the contents are kind of random.  This will display the set of words containing consecutive ee and two y characters:< words2.txt tr ' ' '\n' | grep 'ee' | grep 'y.*y'This first ensures that each word is on its own line with tr, then greps for two consecutive e, then greps again for two (possibly non-consecutive) y.  Since each grep is a filter, the end result is the set of words containing both consecutive ee and two y.On my input, the result is:beeyyyeeyyeefyreenydyjyyee