<p>I want to run the command df -h on my pod kubernetes and extract just one line with grep but is not working:</p>
<pre><code>$ df -h 

Filesystem                Size      Used Available Use% Mounted on
overlay                 249.9G     39.8G    210.0G  16% 
tmpfs                    15.6G         0     15.6G   0% /sys/fs/cgroup
shm                      64.0M         0     64.0M   0% /dev/shm
tmpfs                    15.6G    132.0M     15.5G   1% /etc/resolv.conf
tmpfs                    15.6G    132.0M     15.5G   1% /etc/hostname
/dev/vdf                 10.0G      1.8G      8.2G  18% /application
/dev/vda1                50.0G     39.4G     10.6G  79% /etc/application
/dev/vda1                50.0G     39.4G     10.6G  79% /etc/test/application
/dev/vda1                50.0G     39.4G     10.6G  79% /dev/termination-log
</code></pre>
<p><strong>output expect:</strong></p>
<pre><code>/dev/vdf                 10.0G      1.8G      8.2G  18% /application
</code></pre>
<p><strong>I'm trying to run this command:</strong></p>
<pre><code>$ for i in `df -h`; do echo $i | grep '^\/application'; done
/dev/vdf                 10.0G      1.8G      8.2G  18% /application
/dev/vda1                50.0G     39.4G     10.6G  79% /etc/application
/dev/vda1                50.0G     39.4G     10.6G  79% /etc/test/application
</code></pre>
<p>I know you will say &quot; <strong>why you don't grep for /dev/vdf ?</strong> , the answer is that the mounted partition <strong>/application</strong>  will have other pvc name bounded like &quot;/dev/vdb&quot;</p>

Petrisor Petrisor
<p>This seems really simple:</p>
<pre><code>df -h | grep &quot; /application&quot;
</code></pre>
<p>If I understand correctly, you want to check the <code>df -h</code> output and get the one referring to <code>/application</code>, but you want to avoid getting <code>/etc/application</code> too.<br />
Well, adding the space in front of <code>/application</code> solves this.</p>
