For Programmers: Free Programming Magazines  


Home > Archive > AWK > October 2006 > compare files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author compare files
bshah@citadon.com

2006-09-27, 9:56 pm

Hi Gurus,
I need to compare two files which shows me ONLY duplicate entries
(entry common to both files)
i tried "comm" command but it doesn't show me correctly or may be i am
not using it correctly.
Please Help
Regards

Lutz Horn

2006-09-28, 3:56 am

Hi,

* bshah@citadon.com [27 Sep 2006 19:38:11 -0700]:
> I need to compare two files which shows me ONLY duplicate entries
> (entry common to both files) i tried "comm" command but it doesn't
> show me correctly or may be i am not using it correctly.


comm compares sorted files. Did you sort the two input files?

You can use the options -1 and -2 to suppress lines unique to FILE1 and
FILE2, repectively. Using both options makes comm print only the lines
which appear in both files.

Regards
Lutz
Cesar Rabak

2006-10-02, 9:56 pm

bshah@citadon.com escreveu:
> Hi Gurus,
> I need to compare two files which shows me ONLY duplicate entries
> (entry common to both files)
> i tried "comm" command but it doesn't show me correctly or may be i am
> not using it correctly.


There are a few to things to ask:

1) comm expect the two files to be sorted, is it the case?

2) how much difference is it expected to be between the files?

3) case counts as different or should be ignored?

4) blanks (spaces, tabs, etc.) are to be considered or not?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com