How can I resolve in Linux with printf this issue? : <p>I need to make a table in Shell. So, I thought that firstly I search the longest string, after that I will format, that every column to have that length. My issue is that I can't insert in printf a variable. Here is my code:</p>

<pre><code>while read line
do
    printf "%-$longestfile s" $line
done &lt; fajlok.txt
</code></pre>
