This post originated from an RSS feed registered with Ruby Buzz
by Florian Frank.
Original Post: Tail of emerge.log
Feed Title: The Rubylution: Tag Ruby
Feed URL: http://rubylution.ping.de/xml/rss/tag/ruby/feed.xml
Feed Description: Starts… Now.
I tailed my /var/log/emerge.log on one of my gentoo systems, and saw that they give the time in unixtime stamps (= seconds since the epoch). This is a bit difficult to interpret, so I came up with this short oneliner in Ruby, which converts the timestamp into ISO format (my fav!):
It's a few characters longer, but not much. It's easy to see from this example, that Ruby and Perl are very similar, especially regarding command line options and special $-variables. Well, I guess Ruby was a bit "inspired" by Perl. But somehow I like the Ruby oneliner better and it seems clearer to me (and it doesn't require loading a special module). To use Perl's black magic /e modifier, always seemed to be a bit dirty to me as well.