<p>I want to get a list of all kubernetes nodes with seperated by comma for using it in <code>NO_PROXY</code> env variable and wrote the following commands:</p>

<pre><code>kgnoowide | grep -v NAME | awk '{printf  "%s,", $1}'
</code></pre>

<p>This itself works, with a little detail missing: When having three nodes like</p>

<pre><code>node1
node2
node3
</code></pre>

<p>my awk command returns <code>node1,node2,node3,</code></p>

<p>So the last comma is wrong, a perfect output would be <code>node1,node2,node3</code>. I know this is a minor problem that could easily solved by simply removing the comma when pasting. But I'm interested how to solve this with <code>awk</code>, that itself is a very powerfull tool so I assume it should be possible. And it's also relevant for later usage in scripts, that e.g. generate a <code>~/.bashrc</code> entry with the correct <code>NO_PROXY</code> variable. </p>

Daniel
<p>You don't need grep there</p>

<pre><code>kgnoowide | awk '!/NAME/{out=(out sep $0);sep=","} END{print out}'
</code></pre>
