Re: diff

From: Jared Still <jkstill_at_gmail.com>
Date: Mon, 21 Dec 2009 10:26:14 -0800
Message-ID: <bf46380912211026y5e693b70pa335c9ebd99528a9_at_mail.gmail.com>



On Mon, Dec 21, 2009 at 10:15 AM, Gus Spier <gus.spier_at_gmail.com> wrote:

> What comes to my mind is why we fool around with the diff/sort/sed/awk
> stuff at all.
>
> SELECT <COLUMN LIST> FROM TABLE A
> MINUS
> SELECT <COLUMN LIST> FROM TABLE B
> will return all the rows in the first, but not the second. If you need
> further differences, transpose the select statements and put a UNION between
> them.
>
> And, as an added bonus, the whole thing is on topic, no?
>
>

Much better, and obvious.

It usually pays to take a step back and ask what the real goal is.

Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist Oracle Blog: http://jkstill.blogspot.com Home Page: http://jaredstill.com

> Regards,
>
> Gus
>
> (and PS:)
>
> All praise to list admins for all they do for the community!
>
>
>
>
> On Mon, Dec 21, 2009 at 12:17 PM, Jared Still <jkstill_at_gmail.com> wrote:
>
>>
>> On Mon, Dec 21, 2009 at 3:36 AM, Noor Mulla <Noor.Mulla_at_hcl.in> wrote:
>>
>>> However, if the contents in both the files are not in sequence(side by
>>> side) its not giving the correct output.
>>>
>>> I am using this command - diff a.txt b.txt |awk '{ if($2 != $4) print
>>> }'| awk '{printf "%s %s\n",$1, $4}'> result.out
>>>
>>> How can I get the results irrespective of data not sorted or is there a
>>> way that both files can be sorted for order and ignore space/tab etc.
>>>
>>>
>> Doing so without programming will require ignoring or removing blank
>> lines, and sorting the data prior to doing the diff.
>>
>> See the sort and diff man pages - most 'diff's can ignore blanks.
>>
>>>
>>>
>>> Finally, I want to send the result to my manager via mailx ….
>>>
>>> ...
>>>
>>> How can I club all 3 result* file into one. If I open output.txt file I
>>> should be able to identify result1.out,result2.out etc…
>>>
>>>
>>>
>> Read the man page for whatever shell you are using.
>> Redirect can be used in both overwrite and append mode.
>>
>> In regards to my previous reply - it looks like you are making an
>> attempt to solve this on your own. :)
>>
>> Jared Still
>> Certifiable Oracle DBA and Part Time Perl Evangelist
>> Oracle Blog: http://jkstill.blogspot.com
>> Home Page: http://jaredstill.com
>>
>>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Dec 21 2009 - 12:26:14 CST

Original text of this message