title: How do I read a gzip file line by line?
body: <p>I have a gzip file and currently I read it like this:</p>
  
  <pre><code>infile = open("file.log.gz")
  gz = Zlib::GzipReader.new(infile)
  output = gz.read
  puts result
  </code></pre>
  
  <p>I think this converts the file to a string, but I would like to read it line by line.</p>
  
  <p>What I want to accomplish is that the file has some warning messages with some garbage, I want to grep those warning messages and then write them to another file. But, some warning messages are repeated so I have to make sure that i only grep them once. Hence line by line reading would help me.</p>