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.
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.
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.
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.