title: Awk: formatted print of varying number of elements
body: <p>I want to printf records with varying number of elements, or, for example, a jagged array.  The element types are a %s followed by undeterminate number of %d.</p>
  
  <p>Example input, pseudo-code, desired output:</p>
  
  <pre><code>$ echo "abc 1 2 3 4 5
    def 8 9
    sometext 5000 23 4 34 56 112" |
  awk '{printf "% 10s % 5d % 5d*.......", &lt;each element&gt;'
  $        abc     1     2     3     4     5
           def     8     9
      sometext  5000    23     4    34    56   112
  </code></pre>
  
  <p><code>% 5d*.......</code> How to specify a repeating format sub-string?</p>
  
  <p><code>&lt;each element&gt;</code>  How to declare each element?</p>
  
  <p>Is there an (g)awk equivalent to C's vprintf or say <code>printf "%s *%d" el for el in array</code> where the %d specifier is automatically repeated the correct number of times.</p>
  
  <p>I can't find anything on google which I find surprising.  I can't imagine I'm the first person to want to print jagged arrays in a pretty formatted way.</p>