Need logic to implement file compare.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need logic to implement file compare.
# 1  
Old 09-28-2012
Need logic to implement file compare.

Hi all
I have a requirement where i have to develop a file compare tool.
Requirement:
I have one expected file and one actual file. Both the files are database dumps in a csv file comma seperated. The first line of the file has the column names.
Now there are 3 scenarios:
1) Firstly we have don't have records in sorted order in the file so we have to first find the corresponding match of the records.
2) Secondly if the record does not finds it match, then the record is candidate for two things: a) either it has corresponding record with mismatch, or b) it is completely new record (which has got introduced the second time when i was taking the database dumps in actual file).

constraints or issues:
1)I don't have anything like key or column value which i can use to distinguish or relate two records.
2) I cannot sort the records at database level coz i am not sure of on which column should i sort the records(also i have more than 3000 tables... so identifying such columns at database level is not feasible.)
3) I cannot use Primary keys as all of those are system generated and could generate random values.

I have tried using market tools like diff, winmerge, csvdiff, beyondCompare,CompareIt etc. but known of this tool could suffice to my requirement.
I had this tool TableTextComparator tool. This tool is perfect for my requirement, but this is not supported for linux and it also does not support command line arguments like passing file values.
I had written the logic via shell scripting. But i am still not able to satisfy my requirement on existing issues.

If anyone could recommend me some linux/unix based tool(which suffice my requirement) or tell me the logic it would be of great help.

TIA
Regards
Ganesh
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

2. Shell Programming and Scripting

How to implement "not in" logic in UNIX script?

Hi Gurus, I need use "not in " logic in my script, like below if $name not in exception_file_list, then do something. anyone can help out this? Thanks in advance. (5 Replies)
Discussion started by: ken6503
5 Replies

3. UNIX for Dummies Questions & Answers

Looping Logic, Need to implement

I need to implement a looping logic. If then Go to /path1/file* Get all the filename starting with file* and store it in a array count file number and store it in variable like run Ex: I found 3 file with starting file* so my run = 3 means my loop should run three time May be... (1 Reply)
Discussion started by: Nsharma3006
1 Replies
Login or Register to Ask a Question