01-08-2010
Compare script
I have 8 set of files.
eg:
File 1 -- sybase row count
emp 45
dept 55
outln 78
xxx 91
File 2 -- oracle row count
emp 71
dept 10
outln 78
xxx 91
rtyurtuyrtuyrt 123
ghdfghdfghgh 6578
We have to compare such files get the difference and send output via mailx. See the program below it shows output like
next_number -1
v_man 5
I want to also display the text which is present in file 1 and not in file 2.
Alos display should have heading as -
Table _name oracle_count sybase_count Diff
Could you alter my prog or give a better prog.
#!/bin/ksh
DBALIST='abc@xyz.com'
SUBJECT="WARNING: xxx"
flag='N'
while read a1 a2
do
echo $a1
flag='N'
while read b1 b2
do
if [ $a1 = $b1 ]
then
flag='Y'
if [ $a2 = $b2 ]
then
echo matching
elif [ $a2 != $b2 ]
then
dif=`expr $a2 - $b2`
echo $a1 $dif >> diff.out
fi
fi
done < oracle.sql
if [ $flag = 'N' ]
then
echo $a1 $a2 >> diff_master.out
fi
done < sybase.sql
mailx -s "$SUBJECT" $DBALIST < test.out
-------
Add the following header as first line in each email report:
Table_Name Sybase_RowCount Oracle_RowCnt Diff
Script needs comments and indenting to make it more readable. Indenting needed to visually see the if/elif/fi blocks and do blocks. Script does not capture any information if table exists in Sybase and not in Oracle or viceversa
If script finds no differences for any schema, still should get email indicating no differences for that schema.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
HI
i wil get input from sql query and that too i can get a list o f files or just one.
i have to pick up a file from another directory which hads prefix to this prefix.x.x.x.x.x. And we have to discard prefix and use that file name.
we have to compare this file name(no need... (0 Replies)
Discussion started by: pulse2india
0 Replies
2. Shell Programming and Scripting
Hello,
I am looking for a script, or pointer to an approach to creating a script, that will compare two versions of a codebase and output a third directory structure containing only the files that differ between the two. I use diff quite often, but it will only create patch files (AFAIK). Does... (3 Replies)
Discussion started by: jwilliams108
3 Replies
3. Shell Programming and Scripting
I need a simple script to parse a file with this data in it and have that script output a warning when CurrCapacity is more that 50% of MaxCapacity for a given pool Name, can anyone help ?
CurrCapacity: 5
MaxCapacity: 20
Name: fhlwDSource
CurrCapacity: 5
... (3 Replies)
Discussion started by: init0
3 Replies
4. UNIX Desktop Questions & Answers
From couple of hours i try to do a script to compare file MD5.
Help would be very appreciated :)
First i read the md5 stored into a text file (no problem): md5=`grep -P "^{32}" $file`
then i want to calculate the checksum and store it :
cmd5=`md5sum licence.gvcl`
then problems arrives, i... (5 Replies)
Discussion started by: giova
5 Replies
5. Shell Programming and Scripting
Hi All,
I am very new to scripting and wanted to write a script for comparison of folder including binary files like ear's and jars. Following is the job for which I need it:
1. Compare two folders recursively
2. Compare the binaries like ear's but exclude files like MANIFEST files
3.... (1 Reply)
Discussion started by: maverick.topgun
1 Replies
6. Shell Programming and Scripting
Hi All,
I wil be having Files as below in SourceFile_Path DIR
AA.20110131
AA.20110228
AA.20110202
AA.20110330
BB.20091031
I want to Keep only monthly (20110131,20110228,20100229,20110330) in First SourceFile_Path, If it is not monthly file then want to Move files to some another... (5 Replies)
Discussion started by: samadhanpatil
5 Replies
7. Shell Programming and Scripting
I need a script to compare 1 file with all others then print off any new lines which the other files do not have.
Running:
Solaris 10 5/09 s10s_u7wos_08 SPARC
Any help or pointers would be appreciated (26 Replies)
Discussion started by: llcooljatt
26 Replies
8. Shell Programming and Scripting
i am working on a shell script and need help in the comparing part of it. for e.g. there two text files like this:
file1.txt
name1
name2
name3
file1 has to be comared with file2
defaultfile.txt
name1
name2
name3
name4
and during comparision with defaultfile.txt
if... (2 Replies)
Discussion started by: draghun9
2 Replies
9. Shell Programming and Scripting
Hi,
I have a file, sol_servers_global, which is list of all solaris global servers in my environment and another file,
solaris_non_global_zones_from_DB. I have a gateway server, from where all servers are contactable via ssh. I have collected name of zones running on these servers with below... (3 Replies)
Discussion started by: solaris_1977
3 Replies
LEARN ABOUT DEBIAN
blockdiag
BLOCKDIAG(1) General Commands Manual BLOCKDIAG(1)
NAME
blockdiag - generate block-diagram image file from spec-text file.
SYNOPSIS
blockdiag [options] file
DESCRIPTION
This manual page documents briefly the blockdiag commands.
blockdiag is a program that generate block-diagram image file from spec-text file.
OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is
included below. For a complete description, see the SEE ALSO.
--version
show program's version number and exit
-h, --help
Show summary of options
-a, --antialias
Pass diagram image to anti-alias filter
-c FILE, --config=FILE
read configurations from FILE
-o FILE
write diagram to FILE
-f FONT, --font=FONT
use FONT to draw diagram
--fontmap=FONT
use FONTMAP file to draw diagram
-s, --separate
Separate diagram images for each group
-T TYPE
Output diagram as TYPE format
--nodoctype
Do not output doctype definition tags (SVG only)
--no-transparency
do not make transparent background of diagram (PNG only)
SEE ALSO
The programs are documented fully by
http://tk0miya.bitbucket.org/blockdiag/build/html/index.html
AUTHOR
blockdiag was written by Takeshi Komiya <i.tkomiya@gmail.com>
This manual page was written by Kouhei Maeda <mkouhei@palmtb.net>, for the Debian project (and may be used by others).
May 9, 2011 BLOCKDIAG(1)