Created
April 30, 2011 04:22
-
-
Save taylor/949400 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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