This site have helped me a lot in the past but signed up only now as I couldn't find an exact answer for what am trying now. I hope you would be able to help.
I'm trying to extract or cut the values under a string in a file. My file looks like:
Xmqqstab v1.0 - Developed by Oliver Fisse (ISSW)
****
**** Tuesday, April 26, 2016 10:49:21 AM BST ****
****
UNIX
Report for queue(s): 'Q1' on queue manager 'QMGR'...
CQD PQF MxQD OIC OUC UNC LGETDATE LGETTIME LPUTDATE LPUTTIME QOM G P Local Queue Name
----------------------------------------------------------------------------------------------------------------------------------------------------
5 0.10% 5000 0 0 0 2016-04-26 10.48.46 2016-04-26 10.49.01 26s E E - Q1
1 queue(s) matching.
The file actually gives MQ queue statistics and am trying to get the values under say, CQD=5
(this could be any digit number), LGETTIME=10.48.46
.
I could get the line with the values using: grep -A3 'CQD' file.txt | sed -n '3p'
. And from the line I will have to cut the values by column but I thought it wont be accurate to do so as the digits could vary like 5 in this case could be a four digit number in which case the column numbers would change.
I hope am clear with the question.
Would appreciate any help.
Thanks.