title: How to preserve spaces in awk with fixed column width
body: <p>I've got the following file:</p>
  
  <pre><code>Bonnr. Sessie Tijd  As okr                                        Bedrag  BTW-laag  BTW-hoog           
  ----------------------------------------------------------------------------------------------------- 
  307717   5555 08:08 AS o                                            2,80      0,16                             
  308670   5575 11:28 AS mut Supply Needs           kenmerk         -21,98                              
                             FIRM                                                                    
  308671   5575 11:34 AP o                                            5,60      0,32                     
  </code></pre>
  
  <p>Wanted output:</p>
  
  <pre><code>Bonnr.;Sessie;Tijd ;As;okr;                                       ;Bedrag ;BTW-laag;  BTW-hoog           
  ------;------;-----;--;---;---------------------------------------;-------;--------;----------------- 
  307717;  5555;08:08;AS;o  ;                                       ;  2,80 ;    0,16;                             
  308670;  5575;11:28;AS;mut;Supply Needs           kenmerk         ;-21,98 ;        ;                    
        ;      ;     ;      ;FIRM                                   ;       ;        ;                 
  308671;  5575;11:34;AP;o  ;                                       ;  5,60 ;    0,32;                  
  </code></pre>
  
  <p>I use the following command:</p>
  
  <pre><code>awk 'BEGIN{FIELDWIDTHS="6 7 4 2 4 39 7 8 8";OFS=","}{$1=$1}1' Test.txt &gt; Test.csv
  </code></pre>
  
  <p>My output is:</p>
  
  <pre><code>Bonnr.,Sessie,Tijd,As,okr,Bedrag,BTW-laag,BTW-hoog
  -----------------------------------------------------------------------------------------------------
  307717,5555,08:08,AS,o,2,80,0,16
  308670,5575,11:28,AS,mut,Supply,Needs,kenmerk,-21,98
  FIRM
  308671,5575,11:34,AP,o,5,60,0,32
  </code></pre>
  
  <p>I don't comprehend why awk doesn't preserve the spaces in column six. How can I solve this?</p>