How to search & compare paragraphs between two files
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-
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-
Guys please reply soon, I'll be waiting for your replies eagerly.
Thank you very much.
Naresh
Last edited by Yogesh Sawant; 08-07-2009 at 05:26 AM..
Reason: added code tags
Wow !! the script is working fine, Thank you very mcuh Franklin for your timely help. Many many thanks...:-)
Just a small concern, though few paragraphs are same in text content, but in other file DEV.log the same para have few more blankspaces at the start and also in between texts for which I am not getting the desired output. The situation is like this-
Because of these blank spaces, these paragraphs are also getting listed in output which should not be. Any workaround for this? I tried to manipulate the code, but all in vain. :-(
Thanks,
Naresh
Last edited by Yogesh Sawant; 08-07-2009 at 05:27 AM..
Reason: added code tags
Thanhdat, I am not only trying to remove first tab lines, but also want to remove the blank spaces between text. My script should recognize them as one blankspaces instead of many. For ex-
$ cat file
CREATE TABLE "HELLO"."TABLE1" <b><b><b> ("SALARY" DECIMAL(18,0) NOT NULL )
Output should be like this-
CREATE TABLE "HELLO"."TABLE1"<b>("SALARY" DECIMAL(18,0) NOT NULL)
I want to make a script to compare list of files in terms of its size on local & remote server whose names are same & this is required over ssh. How can I accomplish this.
Any help would be appreciated. (1 Reply)
Hi All,
I have a 2 path, one with oldfile path in which has several sub folders,each sub folders contains a config file(basically text file), likewise there will be another newfile path which will have sub folders, each sub folders contains a config file.
Need to read files from oldfile... (6 Replies)
I have two csv files having 90K records each & each row has around 50 columns.Lets say the file names are FILE1 and FILE2. I have to compare both the files and generate a new file that has rows from FILE2 if it differs.
FILE1
-----
2001,"John",25,19901130,21211.41,Unix Forum... (3 Replies)
Hi
May i ask if someone know a package that will search a directory recursively and compare determine duplicate files according to each filename, date modified or any attributes that will determine its duplicity
If none where should i start or what are those command in shell scripting that... (11 Replies)
Hi forumers,
How is it going. Ok i need some advice on the following problem.
I have 2 files to read and compare data.FileA and FileB. FileA will return either status 1 or 0. FileB on the other hand is trickier and has the following details:-
Count DeviceID CurrentStatus ... (7 Replies)
Friends,
i have two huge complex files (for eg :A & B)as output ,
the sample contents of the files are as follows :
A
==
ID,DATE,SUM1,SUM2,TOTAL(SUM1+2)
A5066,20/04/2010,25000,50000,75000
A5049,20/04/2010,25000,60000,85000
B
==
ID,DATE,SUM1,SUM2,TOTAL(SUM1+2)... (2 Replies)
Hiiii Friends
I have 2 files with huge data. I want to compare this 2 files & if they hav same set of vales in specific rows & columns i need to get that value from one file & replace it in other.
For example: I have few set data of both files here:
a.dat:
PDE-W 2009 12 16 5 29 11.11 ... (10 Replies)