summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2006-10-18 14:22:44 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2006-10-18 14:22:44 +0000
commitd2cd7fc2b6f01b02a73ecfa01dc34e33a2de76eb (patch)
treec533af9fd253ae43bef8d99c2810265a94ad07e0
parent98bafc14abbe560193908130594f892d8c4e3e17 (diff)
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
-rwxr-xr-xbin/weblogs-merge18
1 files 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)
}
}