[CentOS] Inquiry:How to compare two files but not in line-by-line basis?

Thu Dec 3 05:49:08 UTC 2009
hadi motamedi <motamedi24 at gmail.com>

On Wed, Dec 2, 2009 at 11:23 AM, John Doe <jdmls at yahoo.com> wrote:

> From: hadi motamedi <motamedi24 at gmail.com>
> >Sorry . I tried for "#diff -y" but its output seems to have a comparison
> between the two files in line-by-line basis . As you mentioned , if the
> row#1 in file1 is in match with say row#5 in file2 I want it not to be
> considered as a difference. But the the output shows it as if it is being
> considered as a difference. Please correct me .
>
> Could you be more precise when you say "compare"...?
> By example, to get matching lines, you could:
>
>  cat $FILE1 $FILE2 | sort | uniq -c | ...
>
> You'd get each line preceded by the number of occurence; then grep what you
> want...
>
> JD
>
>
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



 Thank you very much for your reply . Please be informed that I tried to
compare the files with your proposed code , as the followings :
#cat Edit3 Edit4 |sort |uniq -c
It is returning the same count on matches as I got from the following code :
#perl -MData::Dumper -le 'while(<>) {chomp; push @{$s->{"$_"}},$ARGV}; END{
print Dumper($s) }' Edit3 Edit4
But it is easier to be used . Can you please do me favor and let me know if
I can go further and try for advanced search like finding how many rows
inside a file have data that does not start with a zero after the third
comma ?
Sincerely Yours
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20091203/d440d212/attachment-0005.html>