title: Using variables in printf format
body: <p>Suppose I have a file like this:</p>
  
  <pre><code>$ cat a
  hello this is a sentence
  and this is another one
  </code></pre>
  
  <p>And I want to print the first two columns with some padding in between them. As this padding may change, I can for example use <code>7</code>:</p>
  
  <pre><code>$ awk '{printf "%7-s%s\n", $1, $2}' a
  hello  this
  and    this
  </code></pre>
  
  <p>Or <code>17</code>:</p>
  
  <pre><code>$ awk '{printf "%17-s%s\n", $1, $2}' a
  hello            this
  and              this
  </code></pre>
  
  <p>Or <code>25</code>, or... you see the point: the number may vary.</p>
  
  <p>Then a question popped: is it possible to assign a variable to this <code>N</code>, instead of hardcoding the integer in the <code>%N-s</code> format?</p>
  
  <p>I tried these things without success:</p>
  
  <pre><code>$ awk '{n=7; printf "%{n}-s%s\n", $1, $2}' a
  %{n}-shello
  %{n}-sand
  
  $ awk '{n=7; printf "%n-s%s\n", $1, $2}' a
  %n-shello
  %n-sand
  </code></pre>
  
  <p>Ideally I would like to know if it is possible to do this. If it is not, what would be the best workaround?</p>