From d2cd7fc2b6f01b02a73ecfa01dc34e33a2de76eb Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 18 Oct 2006 14:22:44 +0000 Subject: Change order of yyyy-mm to yyy and yyyy-mm-dd to yyyy-mm git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@213 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- bin/weblogs-merge | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/bin/weblogs-merge b/bin/weblogs-merge index 1f10cae..60898a3 100755 --- a/bin/weblogs-merge +++ b/bin/weblogs-merge @@ -76,21 +76,23 @@ Dir.glob("*").each{ |client| exit 1 end + # move yyyy-mm-dd to yyyy-mm getfilelist(root+"/"+client+"/"+dir).each { |sourcefile| - m = /(.*-(?:access|error).log.)(\d+)-(\d+).gz/.match(sourcefile) + m = /(.*-(?:access|error).log.)(\d+)-(\d+)-(\d+).gz/.match(sourcefile) next unless m - dummy, name, year, month = m.to_a - next if this_year == year - targetfile = "#{name}#{year}.gz" + dummy, name, year, month, day = m.to_a + next if this_year == year && this_month == month + targetfile = "#{name}#{year}-#{month}.gz" append_and_remove(sourcefile, targetfile) } + # move yyyy-mm to yyyy getfilelist(root+"/"+client+"/"+dir).each { |sourcefile| - m = /(.*-(?:access|error).log.)(\d+)-(\d+)-(\d+).gz/.match(sourcefile) + m = /(.*-(?:access|error).log.)(\d+)-(\d+).gz/.match(sourcefile) next unless m - dummy, name, year, month, day = m.to_a - next if this_year == year && this_month == month - targetfile = "#{name}#{year}-#{month}.gz" + dummy, name, year, month = m.to_a + next if this_year == year + targetfile = "#{name}#{year}.gz" append_and_remove(sourcefile, targetfile) } } -- cgit v1.2.3