diff

From: Noor Mulla <Noor.Mulla_at_hcl.in>
Date: Mon, 21 Dec 2009 17:06:41 +0530
Message-ID: <2468079E02E22A47834078FE416DED3F023C424458_at_BLR-HCLT-EVS06.HCLT.CORP.HCL.IN>



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_at_test.in'
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.


--
http://www.freelists.org/webpage/oracle-l
Received on Mon Dec 21 2009 - 05:36:41 CST

Original text of this message