On Fri, Sep 9, 2011 at 10:38 PM, Cyril J. <cyril.varghese.jose / gmail.com> wrote:
> What is the most efficient way of reading two large files at the same
> time without using too much memory? Also, I need to compare strings in
> the header lines throughout one file with the other file to weed out
> what is different. Just don't know how to start reading the files at the
> same time. Any ideas on how to go about starting this? I was thinking a
> while loop but wasn't really sure on how to implement it. Small example
> would help. Thanks in advance.

What exactly are "header lines" in your case?  Without knowing the
format and your parsing / processing requirements it's difficult to
come up with suggestions.  The most generic is

File.open f1 do |io1|
  File.open f2 do |io2|
    # now what?
  end
end

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/