On Tue, Oct 17, 2006 at 02:31:05PM +0200, Binand Sethumadhavan wrote:
On 17/10/06, Ashok Antony <anjeas_net@xxxxxxxxx> wrote:
I have 2 files. ( Ex: file1 and file2 )
file1 has 15 lines and file2 has 20 lines.
in file1 15 lines are common to file2 how can I take the 5 lines from
file2 which is not in file1 ?
sort file1 file2 | uniq -u
You'll lose the order of the lines, though - unless they are already sorted.
Other ways:
grep -v -f file1 file2 (Assumes file1 is the smaller of the two)
diff -u file1 file2 (You need to do some post-processing)