FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

LinkBack Thread Tools
Old 12-02-2009, 08:47 AM
Brian McKerr
Default Inquiry:How to compare two files but not in line-by-line basis?

diff -y ?

On Wed, Dec 2, 2009 at 7:42 PM, Simon Banton <centos@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:umper -le 'while(<>) {chomp; push @{$s->{"$_"}},

$ARGV}; END{ print Dumper($s) }' file1 file2

... someone will be along shortly with a more elegant method.




CentOS mailing list



CentOS mailing list

Thread Tools

All times are GMT. The time now is 05:43 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org