title: Combine split lines with awk / gawk
body: <p>A system wraps lines in a log file if they exceed X characters. I am trying to extract various data from the log, but first I need to combine all the split lines so gawk can parse the fields as a single record.</p>
  
  <p>For example:</p>
  
  <pre><code>2012/11/01 field1 field2 field3 field4 fi
  eld5 field6 field7
  2012/11/03 field1 field2 field3
  2012/12/31 field1 field2 field3 field4 fi
  eld5 field6 field7 field8 field9 field10 
  field11 field12 field13
  2013/01/10 field1 field2 field3
  2013/01/11 field1 field2 field3 field4
  </code></pre>
  
  <p>I want to return</p>
  
  <pre><code>2012/11/01 field1 field2 field3 field4 field5 field6 field7
  2012/11/03 field1 field2 field3
  2012/12/31 field1 field2 field3 field4 field5 field6 field7 field8 field9 field10 field11 field12 field13
  2013/01/10 field1 field2 field3
  2013/01/11 field1 field2 field3 field4
  </code></pre>
  
  <p>The actual max line length in my case is 130. I'm reluctant to test for that length and use <code>getline</code> to join the next line, in case there is a entry that is exactly 130 chars long.</p>
  
  <p>Once I've cleaned up the log file, I'm also going to want to extract all the relevant events, where "relevant" may involve criteria like:</p>
  
  <ul>
  <li>'foo' is anywhere in any field in the record</li>
  <li><strong>field2</strong> ~ /bar|dtn/</li>
  <li>if <strong>field1</strong> ~ /xyz|abc/ &amp;&amp; <strong>field98</strong> == "0001"</li>
  </ul>
  
  <p>I'm wondering if I will need to run two successive gawk programs, or if I can combine all of this into one.</p>
  
  <p>I'm a gawk newbie and come from a non-Unix</p>