Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[b]Compare data layouts[/b]

Status
Not open for further replies.

Rjconrep

Technical User
Oct 24, 2000
66
0
0
US
I have a folder that contains 500 different lists. I need to create a perl script that will compare each of these files to a master file layout and verify that they are all the same. I need it to log which files don't match the master layout.
 
Cool, thank you for sharing that exciting information with the members of the Tek-Tips Perl forum. On behalf of all members, I wish you good luck and a speedy recovery from your recent accident, the one preventing you from writing the perl script you need.



------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
PS... nice effort on trying to get your subject line to be bold text, nice touch. Shows initiative.

On a more serious note...

Post the code you have written so far and need help with. This is not a script writing service.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Silly question but could you not just checksum them all and compare checksums?
In linux "sum" would give a reasonable (ish) validation value or if you wanted to be really picky and absolutely sure there was no chance of mismatch you could use "gpg".

Then it's just a matter of comparing numbers which is, of course, a very trivial task.

:)



Trojan.
 
Thanks Trojan....at least you have pointed me in some kind of direction. I dont code so this is all new to me as I am sure is obvious. I was told that I could do what I wanted with relative ease using a perl script. I am sure I will figure it out.
 
It sounds like the master is a "template" though, and the files need to be in a similar format, but not exactly the same. In which case, tools like sum/cksum/gpg would not be useful because they would return a completely different result if one single byte differs between the compared files.

Perhaps you could set up the template file as a big regex basically, replacing the parts where varying data is expected with appropriate search strings. Some sample input files would help us advise you.

Annihilannic.
 
Ok let's assume then that these are text files of some kind with rows that we can consider to be records of some kind.
If you saying that you need these list files to be identical (byte for byte) then my previous suggestions obviously stand.
If you are looking to see "at least" the records from the template and/or wish to ensure that none of those records have been altered or removed then you could use comm.

Personally the idea of an enormous file full of regexs makes me feel a little uncomfortable although I can't say that there is necessarily anything wrong with the idea.

HTH.



Trojan.
 
I need to import all of these files into a program that will sort all of the records for the mail stream.
I am using an import template so before I import these files I need to verify that all of the data files are formatted the same. All of the files are in one folder and they are all excel spreadsheets.
Example: Title FirstName LastName Address City State ZIP KeyCode

I need to verify that all of the files have the same info. If not then I need a log telling me which ones were different.
 
Oh crikey, that info would have been useful at the start.
There is a perl cpan module to read Excel Spreadsheets. That might be a starting point for you.



Trojan.
 
Thanks a bunch Trojan
mir09.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top