Okay, say I have this text file:
bash-2.03$ cat test.txt
The quick brown fox
The silly black fox
The code sequence is alpha foxtrot hotel tango.
The elephant smokes pot.
I want to be able to extract lines containing the words "The" and "foxtrot". I can achieve this easily by piping the file into grep, searching for one pattern, then piping those results into another grep process to search for the second pattern. Examples shown here:
bash-2.03$ cat test.txt | grep The | grep foxtrot
The code sequence is alpha foxtrot hotel tango.
bash-2.03$ cat test.txt | grep The | grep fox
The quick brown fox
The silly black fox
The code sequence is alpha foxtrot hotel tango.
What I really want to accomplish is one regex pattern that will do the same thing with one grep process. I figure this should be either exceedingly easy or impossible.