title: Comparing two files column by column in unix shell
body: <p>I need to compare two files column by column using unix shell, and store the difference in a resulting file.</p>
  
  <p>For example if column 1 of the 1st record of the 1st file matches the column 1 of the 1st record of the 2nd file then the result will be stored as '=' in the resulting file against the column, but if it finds any difference in column values the same need to be printed in the resulting file. </p>
  
  <p>Below is the exact requirement.</p>
  
  <p>File 1:</p>
  
  <pre><code>id  code name  place 
  123 abc  Tom   phoenix
  345 xyz  Harry seattle
  675 kyt  Romil newyork
  </code></pre>
  
  <p>File 2:</p>
  
  <pre><code>id  code name  place
  123 pkt  Rosy  phoenix
  345 xyz  Harry seattle
  421 uty  Romil Sanjose
  </code></pre>
  
  <p>Expected resulting file:</p>
  
  <pre><code>id_1 id_2 code_1 code_2 name_1 name_2 place_1 place_2
  =    =      abc  pkt     Tom    Rosy   =       =
  =    =      =    =       =      =      =       =
  675  421    kyt  uty     =      =      Newyork Sanjose
  </code></pre>
  
  <p>Columns are tab delimited.</p>