title: Kettle - Text File Unstructured
body: <p>I have a text file that its structure is not in a single line, it is certain that the lines start with zero (0). Below is the sample:</p>
  
  <pre><code>header : TEXT&lt;br&gt;
  header : TEXT&lt;br&gt;
  header : TEXT&lt;br&gt;
  line 1 : 0TEXT Name Other Field&lt;br&gt;
  line 2 : TEXT Other Field Phone&lt;br&gt;
  line 3 : 0TEXT Name Other Field&lt;br&gt;
  line 4 : TEXT Other Field Phone&lt;br&gt;
  line 5 : 0TEXT  textexttexttext &lt;br&gt;
  line 6 : 0TEXT Name Other Field&lt;br&gt;
  line 7 : TEXT Other Field Phone&lt;br&gt;
  line 8 : 0TEXT Name Other Field&lt;br&gt;
  line 9 : TEXT Other Field Phone&lt;br&gt;
  </code></pre>
  
  <p>What I want to do is get through a regex evaluation the NAME and the PHONE fields and store this values.</p>
  
  <p>Name, Phone
  Name, Phone</p>
  
  <p>The regex part is ok, I already did it.</p>
  
  <p>What I need to know is how to get the values from two different lines and put it in the same register?</p>
  
  <p>I found this forum <a href="http://forums.pentaho.com/showthread.php?53288-Reading-multi-line-records-from-text-file-newbie" rel="nofollow">http://forums.pentaho.com/showthread.php?53288-Reading-multi-line-records-from-text-file-newbie</a> <strike>and tried to apply a javascript suggested, but it didn't work for me, maybe I did something wrong..</strike></p>
  
  <p>I really did some simple wrong and fixed it.</p>
  
  <p>js..</p>
  
  <pre><code>var x;
  var charInitial = line.toString().charAt(0);
  
  if(charInitial == '0') {
      x = line.toString();
  }
  else{
      x += line.toString();
  }
  </code></pre>
  
  <p>With this script I <strike>get the rows separated, I want to concatenate them and after apply the regex.</strike> I can concatenate all the rows that belong to the group, and with a regex I can drop that ones that are unnecessary.</p>
  
  <p>Thanks</p>