[Ilugc] getting file contents

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Tue Oct 17 18:30:24 2006

On Tue, Oct 17, 2006 at 06:18:58PM +0530, Girish Venkatachalam wrote:

On Tue, Oct 17, 2006 at 05:22:30AM -0700, Ashok Antony wrote:
hi all,

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 ?

comm -3 file1 file2

Incorrect. 

It should be

$ sort file1 > tmpfile1
$ sort file2 > tmpfile2
$ comm -3 tmpfile1 tmpfile2

regards,
Girish

Other related posts: