Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
lines_per_day.rb
#!/usr/bin/ruby
# Needed to figure out the daily load on our reporting server. Decided to hit the monthly log file
# and see how many lines per day were being written to it. This was a good excuse to test out some
# new Ruby learning.
logfile = ARGV[0]
101.upto(131) do |day|
day = day.to_s[1..2]
print "April #{day}:\t"
system("grep 201104#{day} #{logfile} | wc -l")
end
dpritchett@LAP-DPRITCHETT ~/work
$ ./lines_per_day.rb ./Dtb_Freds_Planning_201104.log
April 01: 9886
April 02: 108
April 03: 83
April 04: 8293
April 05: 11893
April 06: 12408
April 07: 11832
April 08: 10948
April 09: 89
April 10: 148
April 11: 11320
April 12: 12858
April 13: 13582
April 14: 10867
April 15: 11040
April 16: 1100
April 17: 882
April 18: 12276
April 19: 11287
April 20: 12799
April 21: 1471
April 22: 0
April 23: 0
April 24: 0
April 25: 0
April 26: 0
April 27: 0
April 28: 0
April 29: 0
April 30: 0
April 31: 0
dpritchett@LAP-DPRITCHETT ~/work
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.