[英]how do I check curdepth in bash script?
I want to save the CURDEPTH as a variable in my bash script? 我想将CURDEPTH另存为bash脚本中的变量吗? Is there a way to run this and save the curdepth ammount as a variable?
有没有一种方法可以运行此操作并将当前的深度量保存为变量?
runmqsc QMGR
dis ql (##############) where(curdepth gt 1)
3 : dis ql (##############) where(curdepth gt 1)
AMQ8409: Display Queue details.
QUEUE(#############) TYPE(QLOCAL)
CURDEPTH(71514)
end
Instead of 代替
grep 'CURDEPTH(' | sed 's/.*CURDEPTH//' | tr -d '()'
You can do this if you have GNU grep 如果您有GNU grep,则可以执行此操作
grep -oP '(?<=CURDEPTH\()\d+'
Otherwise, with one sed command 否则,使用一个sed命令
sed -n '/[[:blank:]]*CURDEPTH(\([[:digit:]]\+\))/s//\1/p'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.