Created
July 7, 2009 01:02
-
-
Save ikasamt/141800 to your computer and use it in GitHub Desktop.
hoge.txtはスレッドの内容をテキストのままコピペしたファイル
This file contains 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
data = File.read('hoge.txt') | |
timestamps = data.scan(/2005\/05\/26\(木\)\s(\d{2}:\d{2}:\d{2})/) | |
p timestamps.length | |
hash = {} | |
timestamps.each do |timestamp| | |
if hash[timestamp].nil? | |
hash[timestamp] = 1 | |
else | |
hash[timestamp] += 1 | |
end | |
end | |
puts '--------' | |
hash.each do |k,v| | |
puts "#{k} #{v} #{'|' * v}" | |
end | |
puts '--------' | |
# =====> | |
# 以下実行結果 | |
#-------- | |
# 00:30:43 17 ||||||||||||||||| | |
# 00:30:28 13 ||||||||||||| | |
# 00:30:21 19 ||||||||||||||||||| | |
# 00:30:06 3 ||| | |
# 00:30:44 19 ||||||||||||||||||| | |
# 00:30:22 18 |||||||||||||||||| | |
# 00:30:18 27 ||||||||||||||||||||||||||| | |
# 00:30:00 3 ||| | |
# 00:30:41 19 ||||||||||||||||||| | |
# 00:30:34 31 ||||||||||||||||||||||||||||||| | |
# 00:30:19 21 ||||||||||||||||||||| | |
# 00:30:12 26 |||||||||||||||||||||||||| | |
# 00:30:42 22 |||||||||||||||||||||| | |
# 00:30:35 19 ||||||||||||||||||| | |
# 00:30:20 17 ||||||||||||||||| | |
# 00:30:13 25 ||||||||||||||||||||||||| | |
# 00:30:09 8 |||||||| | |
# 00:30:47 23 ||||||||||||||||||||||| | |
# 00:30:32 26 |||||||||||||||||||||||||| | |
# 00:30:25 14 |||||||||||||| | |
# 00:30:10 26 |||||||||||||||||||||||||| | |
# 00:30:03 16 |||||||||||||||| | |
# 00:30:48 33 ||||||||||||||||||||||||||||||||| | |
# 00:30:33 13 ||||||||||||| | |
# 00:30:26 30 |||||||||||||||||||||||||||||| | |
# 00:30:11 27 ||||||||||||||||||||||||||| | |
# 00:30:04 27 ||||||||||||||||||||||||||| | |
# 00:30:45 14 |||||||||||||| | |
# 00:30:38 19 ||||||||||||||||||| | |
# 00:30:23 29 ||||||||||||||||||||||||||||| | |
# 00:30:16 14 |||||||||||||| | |
# 00:30:01 1 | | |
# 00:30:46 27 ||||||||||||||||||||||||||| | |
# 00:30:40 34 |||||||||||||||||||||||||||||||||| | |
# 00:30:39 31 ||||||||||||||||||||||||||||||| | |
# 00:30:24 2 || | |
# 00:30:17 21 ||||||||||||||||||||| | |
# 00:30:02 5 ||||| | |
# 00:30:36 29 ||||||||||||||||||||||||||||| | |
# 00:30:29 32 |||||||||||||||||||||||||||||||| | |
# 00:30:14 14 |||||||||||||| | |
# 00:30:07 10 |||||||||| | |
# 00:30:37 26 |||||||||||||||||||||||||| | |
# 00:30:30 21 ||||||||||||||||||||| | |
# 00:30:15 17 ||||||||||||||||| | |
# 00:30:08 14 |||||||||||||| | |
# 00:30:49 20 |||||||||||||||||||| | |
# 00:30:31 32 |||||||||||||||||||||||||||||||| | |
# 00:30:27 32 |||||||||||||||||||||||||||||||| | |
# 00:30:05 14 |||||||||||||| | |
#-------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment