Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I understand that you want to extract changed/added lines <strong>from File2</strong>!<br> So in your example there is just one changed line in File2 and no added line in File2.<br> The basic call pattern for <code>diff</code> is <code>diff old new</code> and the output tells you what need to be done to update <code>old</code>. So to learn what is different in File2 you would use it as second argument. I would suggest to use <code>-u</code> option to <code>diff</code>. This gives you every line from File2 that need be changed/added in File1 with a <code> +</code> in the first pos.:</p> <pre><code>diff -u File1 File2 </code></pre> <p>gives</p> <pre><code>--- File1 2012-08-22 11:30:07.000000000 +0200 +++ File2 2012-08-22 11:30:25.000000000 +0200 @@ -1,5 +1,4 @@ 1234,Joe,pieter,joe@gmail.com,male,22 1235,Shally,Jonse,shally@yahoo.com,female,24 -1235,Harry,poter,harry@gmail.com,male,21 +1235,Harry,Potter,harry@gmail.com,male,21 1235,Helen,Jairag,helen@gmail.com,female,21 -2585,Dinesh,Jairag,helen@gmail.com,female,21 </code></pre> <p>Now filter only the lines that start with <code>+</code> except the first two:</p> <pre><code>diff -u data1 data2 | \ awk 'NR &gt; 2 &amp;&amp; $0 ~ /^+/ {print substr($0,2)}' 1235,Harry,Potter,harry@gmail.com,male,21 </code></pre> <p>Or the other way round:</p> <pre><code>diff -u data2 data1 | \ awk 'NR &gt; 2 &amp;&amp; $0 ~ /^+/ {print substr($0,2)}' 1235,Harry,poter,harry@gmail.com,male,21 2585,Dinesh,Jairag,helen@gmail.com,female,21 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload