<p>perl -e '$a=`cat file.txt`;if (grep(/foo/,$a)&&(grep(/blah/,$a))){print "YES\n"}else{print "NO\n"}';</p>
<p>NOTE1: back-tics do not show up on this site. Should be BACK-TIC cat file.txt BACK-TIC
(correction - back-tics do show up if escaped)</p>
<p>NOTE2: And file.txt is from the above example:</p>
<pre><code>stuff blah explore
morestuff explore here
foo
</code></pre>