Skip to content

Instantly share code, notes, and snippets.

@taylor
Created April 30, 2011 04:22
Show Gist options
  • Select an option

  • Save taylor/949400 to your computer and use it in GitHub Desktop.

Select an option

Save taylor/949400 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "rubygems"
begin
require "fastercsv"
myCSV=FasterCSV
rescue LoadError
require 'csv'
myCSV=CSV
end
if ARGV.length == 0
puts "no file given"
exit
end
firstcall=nil
lastcall=nil
s=i=0
myCSV.foreach(ARGV[0]) do |r|
if i == 0
firstcall=r[9]
else
lastcall=r[9]
end
s = s + r[13].to_i
i = i+1
end
m = s / 60
h = m / 60
puts "Total calls: #{i}"
puts "Minutes: #{m}, Hours: #{h}"
puts "First call: #{firstcall}, Last call: #{lastcall}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment