title: Extract string under a string from a file in linux
body: <p>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.</p>
  
  <p>I'm trying to extract or cut the values under a string in a file. My file looks like:</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>The file actually gives MQ queue statistics and am trying to get the values under say, <code>CQD=5</code> (this could be any digit number), <code>LGETTIME=10.48.46</code>.</p>
  
  <p>I could get the line with the values using: <code>grep -A3 'CQD' file.txt | sed -n '3p'</code>. 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.</p>
  
  <p>I hope am clear with the question.</p>
  
  <p>Would appreciate any help.</p>
  
  <p>Thanks.</p>