title: Parsing IBM MQ Series Runmqsc command output
body: <p>I'm using sed/awk to parse mq runmqsc output. We want to get certain fields displayed <strong>on a single line</strong>. This seems to be a straightforward sed/awk problem. </p>
  
  <pre><code>echo "display conn(*) ALL" | 
  runmqsc &lt;BrokerName&gt; | 
  awk '{ RS = "AMQ8276: Display Connection details." } ; { print $0 }' | 
  sed -e 's/( )/()/g'
  </code></pre>
  
  <p>5724-H72 (C) Copyright IBM Corp. 1994, 2009.  ALL RIGHTS RESERVED.
  Starting MQSC for queue manager .</p>
  
  <pre><code> 1 : display conn(*) ALL
  
  
  
  CONN(3923A95601000020)
     EXTCONN(414D51435465737442726F6B65725553)
     TYPE(CONN)
     PID(9263)                               TID(1)
     APPLDESC(WebSphere MQ Object Authority Manager)
     APPLTAG(amqzfuma)                       APPLTYPE(SYSTEM)
     ASTATE(NONE)                            CHANNEL()
     CONNAME()                               CONNOPTS(MQCNO_FASTPATH_BINDING)
     USERID(mqm)                             UOWLOG()
     UOWSTDA()                               UOWSTTI()
     UOWLOGDA()                              UOWLOGTI()
     URTYPE(QMGR)
     EXTURID(XA_FORMATID[00000000] XA_GTRID[] XA_BQUAL[])
     QMURID(0.0)                             UOWSTATE(NONE)
  </code></pre>
  
  <p>This code:</p>
  
  <pre><code>echo "display conn(*) ALL" | runmqsc TestBrokerUS | awk '{ RS = "AMQ8276: Display Connection details." } ; { print $0 }' | sed -e 's/( )/()/g' | 
  sed -n -e 's/^.* CHANNEL(\(.*\).*) /\1/p' -e 's/^.* USERID(\(.*\).*)/\1/p' -e 's/^.* CONNOPTS(\(.*\).*)/\1/p' -e 's/^.* CONN(\(.*\).*)/\1/p' -e 's/^.* CONNAME(\(.*\).*)/\1/p'
  </code></pre>
  
  <p>Returns this:</p>
  
  <pre><code>3923A95601000020)
  )                              CONNOPTS(MQCNO_FASTPATH_BINDING)
  </code></pre>
  
  <p>Need to parse out these fields on 1 line. Thoughts?</p>