Re: diff

There seems to be a failure to communicate here. This list is 'Oracle-L'. I 
don't see any Oracle related questions. Just because there are many people on 
this list that happen to have knowledge on large variety of subjects, that's 
not a license to post questions on any subject that strikes your fancy.

Please restrict your questions to Oracle related subjects.

-Mark

Sent from my iPhone

On Dec 21, 2009, at 6:38, "Noor Mulla" 
<Noor.Mulla@xxxxxx<mailto:Noor.Mulla@xxxxxx>> wrote:

Hi,

I have couple of files (one like below as exmple) which needs to be compared 
using diff command.

File a.txt
Table_name     row_count
A                             10
D                             11
C                             34
D                             45
E                              34
F                              26
G                             83

File b.txt
Table_name     row_count
A                             10
D                             11
C                             34
C1                           67
C2                           87
D                             45
E                              34
E1                           19
E2                           90
F                              26
G                             83

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.

Finally, I want to send the result to my manager via mailx ….

Eg:
DBALIST=’asdf@xxxxxxx’
SUBJECT="WARNING: Row count difference in Oracle Sybase"
diff c.txt d.txt |awk '{ if($2 != $4) print  }' > result1.out
diff e.txt f.txt |awk '{ if($2 != $4) print  }' > result2.out
diff g.txt h.txt |awk '{ if($2 != $4) print  }' > result3.out
mailx -s "$SUBJECT" $DBALIST < output.txt

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…
Thanks & Regards
Noor M Mulla
HCLT - Bangalore


DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. 
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the 
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have
received this email in error please delete it and notify the sender 
immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

Other related posts: