<p>I tried the following but failed to get a list of all pods like these:</p>
<pre><code>my-pod-1
my-pod-19
my-pod-24
</code></pre>
<p>etc.</p>
<pre><code>kgp | grep -E my-pod-[0-9]+
kgp | grep -E my-pod-[0-9]
kgp | grep -i -E my-pod-[0-9]
kgp | grep -i -E &quot;my-pod-[0-9]&quot;
kgp | grep -i -E &quot;^my-pod-[0-9]&quot;
kgp | grep &quot;^my-pod-[0-9]&quot;
kgp | grep -v 'my-pod-[0-9]'

kgp == kubectl get pods
</code></pre>
<hr />
<p>Also following kind Timor's suggestion I tried the following:</p>
<pre><code>user@complt130:/mnt/c/Users/usert$ kubectl get pods | grep -E '^my-
pod-\d+$'
user@complt130:/mnt/c/Users/usert$ kubectl get pods | grep -F '^my-pod-\d+$'
user@complt130:/mnt/c/Users/usert$ kubectl get pods | grep -G '^my-pod-\d+$'
user@complt130:/mnt/c/Users/usert$ kubectl get pods | grep -e '^my-pod-\d+$'
user@complt130:/mnt/c/Users/usert$ kubectl get pods | grep -P '^my-pod-\d+$'
user@complt130:/mnt/c/Users/usert$ kubectl get pods | grep my-pod
my-pod-0                                                      1/1     Running     0          4d9h
my-pod-1                                                      1/1     Running     0          22h
my-pod-aggregator-cronjob-27946622-qnttj                      1/1     Running     0          16m
my-pod-manager-766d97676c-9hb5c                               1/1     Running     0          4d8h
</code></pre>
<hr />
<p>Please advise.</p>

<p>Use <code>grep</code> like so:</p>
<pre><code>kubectl get pods  | grep -P '^my-pod-\d+$'
</code></pre>
<p>Here, GNU <a href="https://www.gnu.org/software/grep/manual/grep.html" rel="nofollow noreferrer"><code>grep</code></a> uses the following option:<br />
<code>-P</code> : Use Perl regexes.</p>
<p><code>^my-pod-\d+$</code> : matches the start of the line, followed by <code>my_pod-</code>, then 1 or more digits until the end of the line.</p>
<p><strong>SEE ALSO:</strong><br />
<a href="https://perldoc.perl.org/perlre" rel="nofollow noreferrer">perlre - Perl regular expressions</a></p>
