Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
use diff to get same and different rows
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ela  
View profile  
 More options Nov 18 2008, 6:03 pm
Newsgroups: comp.unix.solaris
From: "ela" <e...@yantai.org>
Date: Wed, 19 Nov 2008 07:03:28 +0800
Local: Tues, Nov 18 2008 6:03 pm
Subject: use diff to get same and different rows
after man diff, it seems that I cannot generate the 2 output files simply
from files a & b?

file a:
1 2 3
1 1 1

file b:
1 1 1
1 3 9
2 2

OutputSame:
1 1 1

OutputDiff:
file a 1 2 3
file b 1 3 9
file b 2 2


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Havens  
View profile  
 More options Nov 18 2008, 7:43 pm
Newsgroups: comp.unix.solaris
From: Peter Havens <peter.hav...@gmail.com>
Date: Tue, 18 Nov 2008 16:43:59 -0800 (PST)
Local: Tues, Nov 18 2008 7:43 pm
Subject: Re: use diff to get same and different rows
On Nov 18, 4:03 pm, "ela" <e...@yantai.org> wrote:

> after man diff, it seems that I cannot generate the 2 output files simply
> from files a & b?

I'm not sure I understand what you mean, but if you want to do a
comparison without regard to where lines appear in each file (which
seems to be what you want), you could probably use the `comm` command.
For example, to get lines that are common to both files, you might try
something like:

  bash$ comm -12 <(sort a) <(sort b)
  1 1 1

...or to get lines that are not common to both files:

  bash$ comm -13 <(sort a) <(sort b); comm -23 <(sort a) <(sortb)
  1 3 9
  2 2
  1 2 3

I hope that helps.

-- Pete


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ela  
View profile  
 More options Nov 19 2008, 1:35 am
Newsgroups: comp.unix.solaris
From: "ela" <e...@yantai.org>
Date: Wed, 19 Nov 2008 14:35:04 +0800
Local: Wed, Nov 19 2008 1:35 am
Subject: Re: use diff to get same and different rows

"Peter Havens" <peter.hav...@gmail.com> wrote in message

news:78c5cf0f-4e64-412d-8723-40e0b5e6df74@i18g2000prf.googlegroups.com...

  bash$ comm -12 <(sort a) <(sort b)
  1 1 1

...or to get lines that are not common to both files:

  bash$ comm -13 <(sort a) <(sort b); comm -23 <(sort a) <(sortb)
  1 3 9
  2 2
  1 2 3

I hope that helps.

-- Pete

When files a & b both contain the following line,

11821   0       -2      ?->-

comm can't recognize it to be the same. Is there something dealing with the
<( ) and sort mentioned by you? Because I omitted them, which otherwise
caused execution error.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bugbear  
View profile  
 More options Nov 19 2008, 4:54 am
Newsgroups: comp.unix.solaris
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Date: Wed, 19 Nov 2008 09:54:36 +0000
Local: Wed, Nov 19 2008 4:54 am
Subject: Re: use diff to get same and different rows

ela wrote:
> When files a & b both contain the following line,

> 11821   0       -2      ?->-

> comm can't recognize it to be the same. Is there something dealing with the
> <( ) and sort mentioned by you? Because I omitted them, which otherwise
> caused execution error.

Is the whitespace identical ? Trying checking with a  hex editor, or cat -evT
or similar.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ela  
View profile  
 More options Nov 19 2008, 8:16 am
Newsgroups: comp.unix.solaris
From: "ela" <e...@yantai.org>
Date: Wed, 19 Nov 2008 21:16:44 +0800
Local: Wed, Nov 19 2008 8:16 am
Subject: Re: use diff to get same and different rows

"bugbear" <bugbear@trim_papermule.co.uk_trim> wrote in message

news:-dOdnThxu9Mcfr7UnZ2dnUVZ8oCdnZ2d@posted.plusnet...

> ela wrote:
>> When files a & b both contain the following line,

>> 11821   0       -2      ?->-

>> comm can't recognize it to be the same. Is there something dealing with
>> the <( ) and sort mentioned by you? Because I omitted them, which
>> otherwise caused execution error.

> Is the whitespace identical ? Trying checking with a  hex editor, or
> cat -evT
> or similar.

The text is generated by program and therefore should not have typo or any
manmade errors. Another point I'm thinking about is whether ? or > alike are
reserved words that drive comm crazy

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bugbear  
View profile  
 More options Nov 20 2008, 4:26 am
Newsgroups: comp.unix.solaris
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Date: Thu, 20 Nov 2008 09:26:32 +0000
Local: Thurs, Nov 20 2008 4:26 am
Subject: Re: use diff to get same and different rows

Did you check?

    BugBear


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gerard  
View profile  
 More options Nov 20 2008, 5:52 am
Newsgroups: comp.unix.solaris
From: gerard <jd...@free.fr>
Date: Thu, 20 Nov 2008 11:52:15 +0100
Local: Thurs, Nov 20 2008 5:52 am
Subject: Re: use diff to get same and different rows

if yur problem is related to patches, i suggest you take a look at
vsrpatch (Versus patches):
http://www.solaris-fr.org/home/contribs/sys/vrspatch_en

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Harry  
View profile  
 More options Nov 20 2008, 12:54 pm
Newsgroups: comp.unix.solaris
From: Harry <harryooopot...@hotmail.com>
Date: Thu, 20 Nov 2008 09:54:43 -0800 (PST)
Local: Thurs, Nov 20 2008 12:54 pm
Subject: Re: use diff to get same and different rows
On Nov 18, 3:03 pm, "ela" <e...@yantai.org> wrote:

diff is perfectly fine for you.

$ diff --unified=1000 "file a" "file b" | egrep -v "\-\-|\+\+|@@"
   | sed -e 's/-/file a   /;s/+/file b   /;s/^ /file a+b /'
file a   1 2 3
file a+b 1 1 1
file b   1 3 9
file b   2 2


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google