From: Mmcolli00 Mom Date: 2008-12-20T23:16:26+09:00 Subject: get first and last line from txt file - how? I have txt file with date/time stamps only. I want to grab the first date/time and the last date/time. For instance, I will be needing 08/09/08 3:00 and 08/24/08 3:00 from the below queued.txt. Do you know how I can pull these out? Thanks in advance. queued.txt 8/09/08 3:00 8/10/08 5:00 8/23/08 22:00 8/24/08 3:00 firstDate = "" lastDate = "" File.open('queued.txt', 'r') do |f1| while line = f1.gets if f1.lineno == 1 then #<-this would only give me 8/09/08 3:00 @@fistDate = f1 end end -- Posted via http://www.ruby-forum.com/.