<p><strong>I want to delete a process from process list pod_de.csv file</strong></p>

<p><strong>Content of pod_de.csv file</strong></p>

<pre><code>NAME                                READY   STATUS    RESTARTS   AGE
FebwinterMind-897654db-knbbj    2/2     Running   0          46h
DecNightmarch-897654db-n6qhk    2/2     Running   0          6d10h
DecNightmarch-897654db-v2rgt    0/2     Evicted   0          6d10h
DecNightmarch-897654db-5sswn    0/2     Evicted   0          6d10h
DecNightmarch-897654db-hqntn    2/2     Running   0          6d10h
DecNightmarch-897654db-z42r8    2/2     Running   0          35h
DecNightmarch-765897654db-qgbpb     2/2     Running   0          5d14h
AugNightmarch-774bbfc656-96bs6   2/2     Running   0          6d10h
AugNightmarch-774bbfc656-qnnkt   2/2     Running   0          6d10h
FebwinterMind-765897654db-gk5vw      2/2     Running   0          6d13h
FebwinterMind-765897654db-vhk8p      2/2     Running   0          6d13h
ogfileprocess-5h9ih8934b7b-dpbvt      2/2     Running   0          15h
nedesignprocess-765897654db-rshps     2/2     Running   0          6d10h
nedesignprocess-765897654db-rzqf7     0/2     Evicted   0          6d10h
nedesignprocess-765897654db-sbhps     2/2     Running   0          10h
referencedata-765897654db-xlc82      2/2     Running   0          6d11h
clientmyql-58b7d9b687-f9225   2/2     Running   0          5d18h
clientmyql-58b7d9b687-tfmrl   2/2     Running   0          5d18h
</code></pre>

<p>I want to kill "<strong>ogfileprocess-5h9ih8934b7b-dpbvt</strong>" process</p>

<p>I implemented this</p>

<pre><code>#!/bin/bash
pods=$(kubectl get pods &gt; pod_de.csv)
echo "$pods"
Running_OG_process=$(awk '/ogfileprocess/{print $1}' pod_de.csv)
echo "Running Process:" $Running_OG_process
kubectl delete pod $Running_OG_process
</code></pre>

<p><strong>But I am getting additional \r\r\  and due to this it is not killing that particular process</strong></p>

<pre><code>Running Process: ogfileprocess-5h9ih8934b7b-dpbvt
Error from server (NotFound): pods "ogfileprocess-5h9ih8934b7b-dpbvt\r\r" not found
</code></pre>

<p><strong>Actual value getting from file is</strong> </p>

<pre><code>ogfileprocess-5h9ih8934b7b-dpbvt\r\r
</code></pre>

<p><strong>I want</strong> </p>

<pre><code>ogfileprocess-5h9ih8934b7b-dpbvt
</code></pre>

<p>So that I can kill the process.</p>

<p><em>Can Someone help me on this, or can we do this in another way. Full code will be highly appreciated</em> </p>

Chanty
<p>You can just do this to delete pod with <code>ogfileprocess</code> in its name:</p>

<pre><code>kubectl get pods | grep ogfileprocess | awk '{print $1}' | xargs kubectl delete pod
</code></pre>
