Hello Guys, Greetings to All.
I am stuck in my work here today while trying to comapre paragraphs between two files, I need your help on urgent basis, without your inputs I can not proceed. Kindly find some time to answer my question, I'll be grateful to you for ever. My detailed issue is as follows-
I have extracted DDLs of some tables from Production server (saved in PROD.log file), and DDLs of same tables from DEV server (saved in DEV.log file).
The snippet of the contents of these files like this-
$ cat PROD.log
CREATE TABLE "HELLO"."TABLE1" (
"SALARY" DECIMAL(18,0) NOT NULL ,
"JOB" DECIMAL(18,0) NOT NULL )
IN "DAT1" INDEX IN "IDX1" ;
CREATE TABLE "HELLO"."TABLE2" (
"NAME" VARCHAR(18) NOT NULL ,
"AGE" DECIMAL(18,0) NOT NULL )
IN "DAT1" INDEX IN "IDX1" ;
$ cat DEV.log
CREATE TABLE "HELLO"."TABLE1" (
"SALARY" DECIMAL(18,0) NOT NULL ,
"JOB" DECIMAL(18,0) NOT NULL )
DISTRIBUTE BY HASH("SALARY")
IN "DAT1" INDEX IN "IDX1" ;
CREATE TABLE "HELLO"."TABLE2" (
"NAME" VARCHAR(18) NOT NULL ,
"AGE" DECIMAL(18,0) NOT NULL )
IN "DAT1" INDEX IN "IDX1" ;
You can cleary notice, both the files have DDLs of two tables, TABLE1 & TABLE2. Out of these two, TABLE1 DDL is not same but TABLE2 DDL is same in both the files.
My requirement is- I need to write a shell script which will compare both the files PROD.log and Dev.log and will give me the output of whole DDL paragraph which is not matching/existing in other file, the output should look like this-
CREATE TABLE "HELLO"."TABLE1" (
"SALARY" DECIMAL(18,0) NOT NULL ,
"JOB" DECIMAL(18,0) NOT NULL )
IN "DAT1" INDEX IN "IDX1" ;
Guys please reply soon, I'll be waiting for your replies eagerly.
Thank you very much.
Naresh