printing "grep -o" output in single line
<p>How to print output of <code>grep -o</code> in a single line ?  I am trying to print :</p>

<pre><code>$ echo "Hello Guys!" |grep -E '[A-Z]'
Hello Guys!
$ echo "Hello Guys!" |grep -Eo '[A-Z]' &lt;----Multiple lines
H
G
$ echo "Hello Guys!" |grep -Eo '[A-Z]'
</code></pre>

<p>Desired output:</p>

<pre><code>HG
</code></pre>

<p>I am able to cheaply achieve it using following command ,but the issue is that number of letters(3 in this case) could be dynamic. So this approach cannot be used. </p>

<pre><code>echo "HEllo Guys!" |grep -oE  '[A-Z]' |xargs -L3 |sed 's/ //g'
HEG
</code></pre>