From: Vincent Fourmond Date: 2006-09-13T07:18:44+09:00 Subject: Re: getting the last word in each line Hello ! > File.read(some_file).to_a.map { |l| line.split.last } > > What if I wanted to search the lines (based on a regex) and return the > last word in each line that satisfied the search criteria? What about File.read(some_file).to_a.map { |l| line.split.select {|v| v =~ /regex/}.last } Vince