剪切dspmq命令的输出 [英] Cutting the output of a dspmq command
本文介绍了剪切dspmq命令的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试削减dspmq命令的输出
I am trying to cut the output of the dspmq command
这是给出的输出:
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
我尝试了cut命令的各种组合,但没有成功或失败.任何帮助将不胜感激.
I have tried various combinations of the cut command with no luck or success. Any help would be much appreciated.
这是我最近得到的:
dspmq | cut -d "(" -f 2 | cut -d ")" -f 1
基本上只是输出
QMGR
QMGR
QMGR
QMGR
推荐答案
您可以使用此 awk
,
awk -F'[()]' '{ print $2, $4}'
测试:
$ awk -F'[()]' '{ print $2, $4}' file
QMGR Running
QMGR Ended Normally
QMGR Ended Unexpectedly
QMGR Running
这篇关于剪切dspmq命令的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文