Artificial intelligent assistant

How can I print the lines in a file that contain two regex where one is the substring of another If the file has- apple,orange,banana orange ora,orange,apple apple,ora orange,apple,ora,banana I want to print only lines containing `ora` and `orange`- ora,orange,apple orange,apple,ora,banana

With single **_egrep_** :


egrep 'ora\b.*orange|orange.*ora\b' file


The output:


ora,orange,apple
orange,apple,ora,banana


* * *

Or with single **_sed_** expression:


sed -n '/orange/{/ora\b/p}' file
ora,orange,apple
orange,apple,ora,banana


* * *

In both approaches `\b` (word boundary) is used.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 77d64bd58f1690fec6426a6b7e30a08f