|
@@ -46,53 +46,51 @@ $1 ~ "-" || $1 ~ "/", $1 == "\n" {
|
|
|
total = 0
|
|
|
skip = 0
|
|
|
}
|
|
|
- if(skip)
|
|
|
- next
|
|
|
split(cor, arr, "-")
|
|
|
- if(phase == "DATE") {
|
|
|
- if(isDate) {
|
|
|
- if(start_date != "" && $1 < start_date) {
|
|
|
- skip = 1
|
|
|
- next
|
|
|
- } else if(end_date != "" && $1 > end_date) {
|
|
|
- skip = 1
|
|
|
- next
|
|
|
- } else {
|
|
|
- if(type == "monthly") {
|
|
|
- month = arr[1] "-" arr[2]
|
|
|
- if(length(map[month]) == 0)
|
|
|
- map[month] = month
|
|
|
- entry = month
|
|
|
- } else if(type == "weekly") {
|
|
|
- for(i in weekly) {
|
|
|
- split(weekly[i], dates, " -> ")
|
|
|
- start = dates[1]
|
|
|
- split(start, s, "-")
|
|
|
- end = dates[2]
|
|
|
- split(end, e, "-")
|
|
|
- if(arr[2] >= s[1] &&
|
|
|
- arr[2] <= e[1] &&
|
|
|
- arr[3] >= s[2] &&
|
|
|
- arr[3] <= e[2]) {
|
|
|
- if(length(map[weekly[i]]) == 0)
|
|
|
- map[weekly[i]] = weekly[i]
|
|
|
- entry = weekly[i]
|
|
|
- break;
|
|
|
+ if(!skip) {
|
|
|
+ if(phase == "DATE") {
|
|
|
+ if(isDate) {
|
|
|
+ if(start_date != "" && $1 < start_date) {
|
|
|
+ skip = 1
|
|
|
+ } else if(end_date != "" && $1 > end_date) {
|
|
|
+ exit 0
|
|
|
+ } else {
|
|
|
+ if(type == "monthly") {
|
|
|
+ month = arr[1] "-" arr[2]
|
|
|
+ if(length(map[month]) == 0)
|
|
|
+ map[month] = month
|
|
|
+ entry = month
|
|
|
+ } else if(type == "weekly") {
|
|
|
+ for(i in weekly) {
|
|
|
+ split(weekly[i], dates, " -> ")
|
|
|
+ start = dates[1]
|
|
|
+ split(start, s, "-")
|
|
|
+ end = dates[2]
|
|
|
+ split(end, e, "-")
|
|
|
+ if(arr[2] >= s[1] &&
|
|
|
+ arr[2] <= e[1] &&
|
|
|
+ arr[3] >= s[2] &&
|
|
|
+ arr[3] <= e[2]) {
|
|
|
+ if(length(map[weekly[i]]) == 0)
|
|
|
+ map[weekly[i]] = weekly[i]
|
|
|
+ entry = weekly[i]
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ map[$0] = cor " " substr($0, 12)
|
|
|
+ entry = $0
|
|
|
+ }
|
|
|
+ phase = "ENTRIES"
|
|
|
}
|
|
|
} else {
|
|
|
- map[$0] = cor " " substr($0, 12)
|
|
|
- entry = $0
|
|
|
- }
|
|
|
- phase = "ENTRIES"
|
|
|
- }
|
|
|
- } else {
|
|
|
- print "Error with date on line " NR ": " $0
|
|
|
- error = 1
|
|
|
+ print "Error with date on line " NR ": " $0
|
|
|
+ error = 1
|
|
|
+ }
|
|
|
+ } else if(!skip && phase == "ENTRIES") {
|
|
|
+ isDate = 0;
|
|
|
+ map[entry] = map[entry] "<<>>" $0
|
|
|
}
|
|
|
- } else if(!skip && phase == "ENTRIES") {
|
|
|
- isDate = 0;
|
|
|
- map[entry] = map[entry] "<<>>" $0
|
|
|
}
|
|
|
}
|
|
|
END {
|