title: Display two files side by side
body: <p>How can 2 unsorted text files of different lengths be display side by side <em>(in columns)</em> in a <code>shell</code> </p>
  
  <p>Given <code>one.txt</code> and <code>two.txt</code>:</p>
  
  <pre><code>$ cat one.txt
  apple
  pear
  longer line than the last two
  last line
  
  $ cat two.txt
  The quick brown fox..
  foo
  bar 
  linux
  
  skipped a line
  </code></pre>
  
  <p>Display:</p>
  
  <pre><code>apple                               The quick brown fox..
  pear                                foo
  longer line than the last two       bar 
  last line                           linux
  
                                      skipped a line
  </code></pre>
  
  <p><code>paste one.txt two.txt</code> almost does the trick but doesn't align the columns nicely as it just prints one tab between column 1 and 2. <em>I know how to this with emacs and vim but want the output displayed to stdout for piping ect.</em></p>
  
  <p>The solution I came up with uses <code>sdiff</code> and then pipes to sed to remove the output <code>sdiff</code> adds.  </p>
  
  <p><code>sdiff one.txt two.txt | sed -r 's/[&lt;&gt;|]//;s/(\t){3}//'</code></p>
  
  <p>I could create a function and stick it in my <code>.bashrc</code> but surely a command for this exists already (or a <em>cleaner</em> solution potentially)?</p>