Skip to content

Instantly share code, notes, and snippets.

@tatzyr
Created September 4, 2011 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatzyr/1192944 to your computer and use it in GitHub Desktop.
Save tatzyr/1192944 to your computer and use it in GitHub Desktop.
Skypeの会話をコピペしたファイルを日付別に分割
#!/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