From: Bob X Date: 2002-07-06T05:57:49+09:00 Subject: Doesn't quite work...looping question It parses, it opens, but it doesn't write to the outFile. So I am guessing I am not looping through the array properly. #!/usr/bin/ruby -w # populate the array kw = [ "adult", "teen" ] # create a file to append data found from the input file inFile = File.open(ARGV[0], "r") outFile = File.new(ARGV[1], "w+") # search for a word and print the entire line inFile.each_line { |line| for kw in line # keywords to search for print line # let the lines print to console outFile.write line # also print to file end } # close the files inFile.close outFile.close # visual clue script is done puts "Finished processing file..."