title: How to output an array's content in columns in BASH
body: <p>I wanted to display a long list of strings from an array.</p>
  <p>Right now, my script run through a for loop echoing each value to the standard output:</p>
  <pre><code>for value in ${values[@]}
  do
    echo $value
  done
  </code></pre>
  <p>Yeah, that's pretty ugly! And the one column listing is pretty long too...</p>
  <p>I was wondering if i can find a command or builtin helping me to display all those values in columns, like the <code>ls</code> command does by default when listing a directory (<code>ls -C</code>).</p>
  <p><strong>[Update]</strong></p>
  <p>Losing my brain with <code>column</code> not displaying properly formatted columns, here's more info:</p>
  <p>The values:</p>
  <pre><code>$ values=( 01----7 02----7 03-----8 04----7 05-----8 06-----8 07-----8 08-----8 09---6 10----7 11----7 12----7 13----7 14-----8 15-----8 16----7 17----7 18---6 19-----8 20-----8 21-----8)
  </code></pre>
  <p>Notice the first two digits as an index and the last one indicating the string length for readability.</p>
  <p>The command: <code>echo &quot; ${values[@]/%/$'\n'}&quot; | column</code></p>
  <p>The result: <a href="http://tychostudios.ch/multipurpose/bad_columns.png" rel="nofollow noreferrer">bad columns http://tychostudios.ch/multipurpose/bad_columns.png</a></p>
  <p>Something is going wrong...</p>