Created
September 4, 2011 14:41
-
-
Save tatzyr/1192944 to your computer and use it in GitHub Desktop.
Skypeの会話をコピペしたファイルを日付別に分割
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 | |
# coding: utf-8 | |
filename = nil | |
ARGF.each_line do |line| | |
if line =~ /\A(\d{4})年(\d{1,2})月(\d{1,2})日[月火水木金土日]曜日\Z/ | |
filename = "%04d-%02d-%02d.txt" % [$1, $2, $3] | |
end | |
open(filename, "a") do |f| | |
f.puts(line) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment