From: prasad c Date: 2010-07-22T13:53:54+09:00 Subject: Re: finding last line in a file --00c09f8999d86dcf72048bf2b4c1 Content-Type: text/plain; charset=ISO-8859-1 last_line = '' IO.popen("tail -n 1 #{file_name}") { |f| last_line = f.gets } Regards, Prasad C On Thu, Jul 22, 2010 at 9:51 AM, Ted Flethuseo wrote: > Hi everyone, > > Is there a one line command to do this? > > I mean currently I use > > File.foreach(inFile) do |line| > ... > done > > I could do this with a counter, but that is SO UGLY, and I want to do an > operation on that very last line. > > Regards, > Ted. > -- > Posted via http://www.ruby-forum.com/. > > --00c09f8999d86dcf72048bf2b4c1--