From: Jason Peterson Date: 2012-07-07T01:44:11+09:00 Subject: Re: Parsing a zip file for rows of string data Thank you for the reply. When I try running this I get a syntax error. require 'zip/zip' # To open the zip file and pass each entry to a block Zip::ZipFile.foreach(C:\Data\file.zip) do |text_file| # Read from entry, turn String into Array, and pass to block text_file.read.split("\n").each do |line| if line.start_with?("CDI") || line.start_with?("CHO") cdi_output = File.open("cdiout.txt", "a") # Open an output file for CDI cho_output = File.open("choout.txt", "a") # Open an output file for CHO while line = f.gets # Read each line in the input cdi_output.puts line if /^CDI/ =~ line # Print if line starts with CDI cho_output.puts line if /^CHO/ =~ line # Print if line starts with CHO end end cdi_output.close # Close cdi_output file cho_output.close # Close cho_output file I appreciate any help Thanks you, Jay -- Posted via http://www.ruby-forum.com/.