vamsikrishna has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: comparing two huges files
by GrandFather (Saint) on Jan 28, 2008 at 03:55 UTC | |
This sounds very like how to find differences between two huge files. Maybe you could read that thread and find what you need, or perhaps you should talk to your workmate/classmate and see how he solved it? Update: hmm, on second thoughts it's not the same - it was hard to tell because of your rubbish formatting, sorry. Build a hash from the first (smaller) file, then use it in a single pass through the second (larger) file to figure out where stuff goes. Consider:
prints:
Perl is environmentally friendly - it saves trees | [reply] [d/l] [select] |
|
Re: comparing two huges files
by grep (Monsignor) on Jan 28, 2008 at 04:08 UTC | |
Create a hash. Read the 10K file first. Use the 1st col as the key and the rest of the record as the value. Then when you loop over the second file if the first col exists in the original hash, write whatever record you want to the file. Here is some code - It may not do exactly what you want, but that is because I'm guessing your spec.
grep One dead unjugged rabbit fish later... | [reply] [d/l] [select] |