Compare 2 result sets using a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Compare 2 result sets using a script
# 1  
Old 09-21-2010
Compare 2 result sets using a script

select colname from syscat.columns where tabname='t' and tableschema='s'
output is columnnames which are in part of primary key
PK1
PK2
PK3
PK4
PK5
select colname from syscat.columns where tabname ='t1' and tableschema='s'
output is columnnames which are in part of primary key for identical table .
PK1
PK2
PK3
PK4
PK5
any suggession how to compare the result of 1st querry against 2nd querry .using a script .
kanakaraju
# 2  
Old 09-21-2010
Try 'comm' command

A sample result should help!!

Anyways, from what I imagine, try to capture table name along with the column name; sort the file and use the command "comm".
# 3  
Old 09-21-2010
Try 'comm' command

can i have sample example please ?
kanakaraju
# 4  
Old 09-21-2010
"comm file1 file2" gives you three columns
1-> rows only present in file1
2-> rows only present in file2
3-> rows that are common to both files

This should help you if your tables are identical and you just need to know if these two tables have same member columns in the composite primary key.

If you meant something else, plz give an example of expected output.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare 2 columns from the same file and print a value depending on the result

Hello Unix gurus, I have a file with this format (example values): label1 1 0 label2 1 0 label3 0.4 0.6 label4 0.5 0.5 label5 0.1 0.9 label6 0.9 0.1 in which: column 1 is a row label column 2 and 3 are values I would like to do a simple operation on this table and get the... (8 Replies)
Discussion started by: ksennin
8 Replies

2. Shell Programming and Scripting

How to compare the current result with previous line result.?

Hi Gurus, I have requirement to compare current result with previous reuslt. The sample case is below. 1 job1 1 1 job2 2 1 job3 3 2 job_a1 1 2 job_a2 2 2 job_a3 3 3 job_b1 1 3 job_b2 2 for above sample file, GID is group ID, for input line, the job run... (1 Reply)
Discussion started by: ken6503
1 Replies

3. Shell Programming and Scripting

Compare 2 file and write result

Hi friends...I have 2 files, file1.txt and reference.txt I could able to find difference using diff and following command awk 'NR == FNR { A=1; next } !A' reference.txt file1.txt above command listing data which is not in reference.txt 12.12 87 11.95 88 11.83 89 12.55 84... (12 Replies)
Discussion started by: Akshay Hegde
12 Replies

4. Shell Programming and Scripting

How to compare two files to get correct result.see example?

Hello, I have two files A and B .A file consist of the words that user will put whereas file B consist of all user's LDAP a/c.I want here that if user don't mention LDAP a/c in comment than it will exit otherwise success. File A.I have a solution that I will modify the file A ...just save the... (9 Replies)
Discussion started by: anuragpgtgerman
9 Replies

5. Shell Programming and Scripting

compare two files, diff the result

Hi Everyone, 1.txt 00:01:01 asdf 00:33:33 1234 00:33:33 0987 00:33:33 12 00:33:33 444 2.txt vvvv|ee 444|dd33|ee dddd|ee 12|ee 3ciur|fdd the output should be: (6 Replies)
Discussion started by: jimmy_y
6 Replies

6. Shell Programming and Scripting

How to compare result lpstat with hostsfile

Hi there all, I got a long list of printers installed and a longer list of printers in my hosts file. In the hosts file I got a even longer list of printers in the hosts file I got the IP adress of all printers next to the printer name. How can I get a script working to get the printers... (0 Replies)
Discussion started by: draco
0 Replies

7. UNIX for Dummies Questions & Answers

Compare 2 files and output result in pop up window

Need help ! how do i compare 2 files and if there is a difference, output a massage in a pop up window? the script meant to run using crontab. (2 Replies)
Discussion started by: hongsh
2 Replies

8. UNIX for Dummies Questions & Answers

While finding compare the result with given string

Hello, There are directories named by "yyyyMMdd" format. The one directory name is given and I should find & print that directory & its previous days directory names if exist. For example: 20080401 20080402 20080403 20080404 ... The given date: 20080403 The result: 20080403... (4 Replies)
Discussion started by: mr_bold
4 Replies

9. Virtualization and Cloud Computing

Clouds (Partially Order Sets) - Streams (Linearly Ordered Sets) - Part 2

timbass Sat, 28 Jul 2007 10:07:53 +0000 Originally posted in Yahoo! CEP-Interest Here is my follow-up note on posets (partially ordered sets) and tosets (totally or linearly ordered sets) as background set theory for event processing, and in particular CEP and ESP. In my last note, we... (0 Replies)
Discussion started by: Linux Bot
0 Replies
Login or Register to Ask a Question