Cutting the output of a dspmq command

I am trying to cut the output of the dspmq command

This is the output given:

QMNAME(QMGR)                                              STATUS(Running)
QMNAME(QMGR)                                              STATUS(Ended Normally)
QMNAME(QMGR)                                              STATUS(Ended Unexpectedly)
QMNAME(QMGR)                                              STATUS(Running)

This is how I would like the output to look:

QMGR Running
QMGR Ended Normally
QMGR Ended Unexpectedly 
QMGR Running 

I have tried various combinations of the cut command with no luck or success. Any help would be much appreciated.

This is the closest I have got:

dspmq | cut -d “(” -f 2 | cut -d “)” -f 1

Which basically just outputs

QMGR
QMGR
QMGR
QMGR   


Source: unix

Leave a Reply