title: bash + how to capture word from a long output
body: <p>I have the following output from the following command</p>
  <pre><code>zookeeper-shell.sh 19.2.6.4  get /brokers/ids/1010
  </code></pre>
  <p>output is</p>
  <pre><code>Connecting to 19.2.6.4
  
  WATCHER::
  
  WatchedEvent state:SyncConnected type:None path:null
  {&quot;listener_security_protocol_map&quot;:{&quot;PLAINTEXT&quot;:&quot;PLAINTEXT&quot;},&quot;endpoints&quot;:[&quot;PLAINTEXT://kafka1.lulu.com:6667&quot;],&quot;rack&quot;:&quot;/default-rack&quot;,&quot;jmx_port&quot;:9997,&quot;port&quot;:6667,&quot;host&quot;:&quot;kafka1.lulu.com&quot;,&quot;version&quot;:4,&quot;timestamp&quot;:&quot;1630507307906&quot;}
  </code></pre>
  <p>The main target is to capture the machine name <code>kafka1</code> – from above output</p>
  <p>So  I successes to do the following long command syntax</p>
  <pre><code>zookeeper-shell.sh 119.2.6.4  get /brokers/ids/1010 | sed s'/\/\// /g' | sed s'/:/ /g' | sed s'/,/ /g' | sed s'/&quot;/ /g' | sed s'/\./ /g'| awk '{for (i=1;i&lt;=NF;i++) print $i}' | grep -i kafka | sort | uniq
  </code></pre>
  <p>and the results is:  ( as expected results )</p>
  <pre><code>kafka1
  </code></pre>
  <p><strong>the case is that I feel bad with my approach</strong> , its too long and not so elegant</p>
  <p>can we get suggestion ( with awk/sed/perl one liner ) , that are much better from my syntax?</p>