From: Jason Sweat Date: 2005-03-21T12:57:46+09:00 Subject: Re: equivalent idiom for ruby " perl -pe 's/(\d+)/localtime($1)/e'" On Mon, 21 Mar 2005 12:51:43 +0900, James Edward Gray II wrote: > On Mar 20, 2005, at 9:14 PM, Pe�a, Botp wrote: > > > Hi, > > > > forgive my perl ignorance, but how do you convert the ff perl idiom to > > ruby(way): > > > > perl -pe 's/(\d+)/localtime($1)/e' /var/log/squid/access.log > > ruby -pe 'gsub!(/\d+/) { |t| Time.at(t.to_i) }' > /var/log/squid/access.log > > I think. > > James Edward Gray II > > cat /var/log/squid/access.log | ruby -pe '$_.gsub!(/^(\d+)/, Time.at($1.to_i).to_s)' seemed to work for me Regards, Jason http://blog.casey-sweat.us/