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

hadi motamedi motamedi24 at gmail.com
Wed Dec 2 09:56:05 UTC 2009


But "#diff -y" compares the two files in line-by-line basis . But my two
files do not have one-to-one correspondence , say row#1 in file1 maybe the
same as say row#5 in file2 . So I seek a way that does not consider this as
a difference (but diff will consider).



On Wed, Dec 2, 2009 at 9:47 AM, Brian McKerr <bmckerr at gmail.com> wrote:

> diff -y ?
>
>
> On Wed, Dec 2, 2009 at 7:42 PM, Simon Banton <centos at web.org.uk> wrote:
>
>>  At 08:54 +0000 2/12/09, hadi motamedi wrote:
>> >Dear All
>> >Can you please do me favor and let me know how can I compare two
>> >files but not in line-by-line basis on my CentOS server ? I mean say
>> >row#1 in file1 has the same data as say row#5 in file2 , but the
>> >comm compares them in line-by-line basis that is not intended . It
>> >seems that the diff cannot do the job as well
>>
>> This'll show you which lines are common to both files, and for the
>> ones that aren't which file they're in.
>>
>> perl -MData::Dumper -le 'while(<>) {chomp; push @{$s->{"$_"}},
>> $ARGV}; END{ print Dumper($s) }' file1 file2
>>
>> ... someone will be along shortly with a more elegant method.
>>
>> HTH
>>
>> S.
>> _______________________________________________
>> CentOS mailing list
>> CentOS at centos.org
>> http://lists.centos.org/mailman/listinfo/centos
>>
>
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.centos.org/pipermail/centos/attachments/20091202/53d1d591/attachment.html 


More information about the CentOS mailing list