title: How to transfer the data of columns to rows (with awk)?
body: <p>I have a file like this:</p>
  
  <pre><code>n A B C D 
  1 01 02 01 01
  2 02 02 01 01
  </code></pre>
  
  <p>and I want to transfer the columns by rows, so the output should be like this:</p>
  
  <pre><code>n 1 2
  A 01 02
  B 02 02
  C 01 01 
  D 01 01
  </code></pre>
  
  <p>I have wrote this command:</p>
  
  <pre><code>awk '{ for (i=1;i&lt;=NF;i++ ) printf $i " " }' file.txt &gt; out-file.txt
  </code></pre>
  
  <p>the problem is that this command put everything on one line! so the output is like this:</p>
  
  <pre><code>n 1 2 A 01 02 B 02 02 C 01 01 D 01 01
  </code></pre>