<p>I am having issue to use grep with regular expression 
I am trying to read and filter some logs on server</p>

<pre><code>kubectl logs -lname=ambassador --tail=40 | grep ACCESS | grep '" 200 ' | grep ' /api/entitlements '
</code></pre>

<p>so this returns some logs and it is fine but I need to search for all api including entitlements in their path. I tried this:</p>

<pre><code>kubectl logs -lname=ambassador --tail=40 | grep ACCESS | grep '" 200 ' | grep ' *entitlements* '
</code></pre>

<p>but nothing returns</p>

<p>can anyone help?</p>

Learner
<p>You may use <code>awk</code> to avoid multiple <code>grep</code> command and do all filters in one command:</p>

<pre><code>kubectl logs -lname=ambassador --tail=40 | awk '/ACCESS/ &amp;&amp; /" 200 / &amp;&amp; /entitlements/'
</code></pre>

<p><code>/substr/</code> searches for regex pattern <code>substr</code> in each line of <code>awk</code>. <code>&amp;&amp;</code> ensures that all the given patterns are found in same line.</p>
