title: Ruby data extraction from a text file
body: <p>I have a relatively big text file with blocks of data layered like this:</p>
  
  <pre><code>ANALYSIS OF X SIGNAL, CASE: 1
  TUNE X =  0.2561890123390808
  
      Line Frequency      Amplitude             Phase             Error         mx  my  ms  p
  
  1 0.2561890123391E+00 0.204316425208E-01 0.164145385871E+03 0.00000000000E+00   1   0   0   0
  2 0.2562865535359E+00 0.288712798671E-01 -.161563284233E+03 0.97541196785E-04   1   0   0   0
  </code></pre>
  
  <p>(they contain more lines and then are repeated)</p>
  
  <p>I would like first to extract the numerical value after <code>TUNE X =</code> and output these in a text file. Then I would like to extract the numerical value of <code>LINE FREQUENCY</code> and <code>AMPLITUDE</code> as a pair of values and output to a file.</p>
  
  <p>My question is the following: altough I could make something moreorless working using a simple REGEXP I'm not convinced that it's the right way to do it and I would like some advices or examples of code showing how I can do that efficiently with Ruby.</p>