title: Remove whitespace before a field using AWK
body: <p>(<em>Almost exact duplicate of <a href="https://stackoverflow.com/questions/408469/keeping-original-format-post-passing-through-awk">Keeping original format POST passing through AWK</a> submitted by same person.</em>)</p>
  
  <p>I have a simple question pertaining to <b>g</b>awk, illustrated below:</p>
  
  <pre><code>  1 int blah (void)
    2 {
    3         if (foo) {
    4                 printf ("blah\n");
    5         }       
    6         return 0;
    7 }  
  </code></pre>
  
  <p>Using the following gawk code - using gensub() to maintain original formatting:</p>
  
  <pre><code> gawk '{ print gensub($1, "\t", 1) }' ./sample_code.out
  
       int blah (void)
       {
               if (foo) {
                       printf ("blah\n");
               }       
               return 0;
       }  
  </code></pre>
  
  <p>How can I use <b>g</b>awk or awk (maybe with regular expressions) to remove previous whitespace before field $1 <b>(^ )</b></p>
  
  <p>Illustrated below:</p>
  
  <pre><code> int blah (void)
   {
           if (foo) {
                   printf ("blah\n");
           }       
           return 0;
   }  
  </code></pre>
  
  <p>Kind regards in advance</p>