title: Copy differences between two files in unix
body: <p>Firstly, which is the best and fastest unix command to get only the differences between two files ? I tried using diff to do it (below).</p>
  
  <p>I tried the answer given by Neilvert Noval over here - <a href="https://stackoverflow.com/questions/4544709/compare-two-files-line-by-line-and-generate-the-difference-in-another-file">Compare two files line by line and generate the difference in another file</a></p>
  
  <p>code - </p>
  
  <pre><code>diff -a --suppress-common-lines -y file1.txt file2.txt &gt;&gt; file3.txt
  </code></pre>
  
  <p>But, I get a lot of spaces and a > symbol also before the different lines. How do I fix that ? I was thinking of removing trailing spaces and the first '>', but not sure if that is a neat fix.</p>
  
  <p>My file1.txt has - </p>
  
  <pre><code>Hello World!
  Its such a nice day!
  #this is a newline and not a line of text# 
  </code></pre>
  
  <p>My file1.txt has - </p>
  
  <pre><code>Hello World!
  Its such a nice day!
  Glad to be here!
  #this is a newline and not a line of text# 
  </code></pre>
  
  <p>Output - " #Many spaces here# > Glad to be here:)"</p>
  
  <p><strong>Expected output -</strong> Glad to be here:)</p>