title: Regular expression as field delimiter in awk
body: <p>I have a large dataset with 586696 lines and 40 columns. However, I'm only interested in some of these columns. One has names in it and the other has numbers.</p>
  
  <p>I'm having a hard time dealing with the field delimiters in this file. All of the columns delimiters are spaces. If you suppose that my file is called <code>test.txt</code> and it has 5 people in it, it looks like this:</p>
  
  <pre><code>Name Salary
  FirstName01 LastName01 Salary01
  FirstName02 MiddleName02 LastName02 Salary02
  FirstName03 MiddleName03 LastName03 Salary03
  FirstName04 LastName04 Salary04
  FirstName05 MiddleName05 LastName05 Salary05
  </code></pre>
  
  <p>Hence, if I run </p>
  
  <pre><code>awk '{print $1 " " $2}' test.txt
  </code></pre>
  
  <p>the result is </p>
  
  <pre><code>Name Salary
  FirstName01 LastName01
  FirstName02 MiddleName02
  FirstName03 MiddleName03
  FirstName04 LastName04
  FirstName05 MiddleName05
  </code></pre>
  
  <p>but what I want is</p>
  
  <pre><code>Name Salary
  FirstName01 LastName01 Salary01
  FirstName02 MiddleName02 LastName02 Salary02
  FirstName03 MiddleName03 LastName03 Salary03
  FirstName04 LastName04 Salary04
  FirstName05 MiddleName05 LastName05 Salary05
  </code></pre>
  
  <p>For the sake of this problem, assume there are columns before the column <code>Name</code> and after column <code>Salary</code>.</p>
  
  <p>How can I solve my problem? I guess I have to use some regular expression as the field delimiter to use awk here, but I couldn't find a way to do it.</p>
  
  <p><strong>Edit:</strong> I think I wasn't clear in the original post. I know awk is giving me exactly what I ask. My problem is that my full dataset is something like</p>
  
  <pre><code>Column01 Column02 Column03 Name Salary Column06 ...
  Text0101 Text0102 Text0103 FirstName01 LastName01 Salary01 ...
  Text0201 Text0202 Text0203 FirstName02 MiddleName02 LastName02 Salary02 ...
  Text0301 Text0302 Text0303 FirstName03 MiddleName03 LastName03 Salary03 ...
  Text0401 Text0402 Text0403 FirstName04 LastName04 Salary04 ...
  Text0501 Text0502 Text0503 FirstName05 MiddleName05 LastName05 Salary05 ...
  </code></pre>
  
  <p>Given the above table, I want an awk code that can produce the following result:</p>
  
  <pre><code>Name Salary
  FirstName01 LastName01 Salary01
  FirstName02 MiddleName02 LastName02 Salary02
  FirstName03 MiddleName03 LastName03 Salary03
  FirstName04 LastName04 Salary04
  FirstName05 MiddleName05 LastName05 Salary05
  </code></pre>
  
  <p>Sorry about my misleading question.</p>