summaryrefslogtreecommitdiff
path: root/mac
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-11-04 09:57:30 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-11-04 09:57:30 +0900
commit2025ee780a0fac69174933497974139425edd742 (patch)
tree18482a8d4d76678c4420c2913b7d15413d69a448 /mac
parentbce6d75fea73a8c9a3273c55248a1bc008c546ed (diff)
modified bin/ylog
Diffstat (limited to 'mac')
-rwxr-xr-xmac/.local/bin/ylog34
1 files changed, 29 insertions, 5 deletions
diff --git a/mac/.local/bin/ylog b/mac/.local/bin/ylog
index 645c6fa..89c1610 100755
--- a/mac/.local/bin/ylog
+++ b/mac/.local/bin/ylog
@@ -308,14 +308,38 @@ if [ -f "$RESULTS_TMP" ] && [ -s "$RESULTS_TMP" ]; then
}
}
END {
- # Output: simple approach - print all unique entries
- # Since we want chronological order, we need to sort by timestamp
- # For simplicity, just print the unique entries
+ empty_str = \"\"
+ idx = 0
for (key in latest) {
- print latest[key]
+ line = latest[key]
+ pos = match(line, /\\[[0-9]{2}\\/[A-Z][a-z]{2}\\/[0-9]{4}:[0-9]{2}:[0-9]{2}:[0-9]{2}/)
+ if (pos > 0) {
+ datetime = substr(line, pos + 1, 20)
+ date_part = substr(datetime, 1, 11)
+ time_part = substr(datetime, 13, 8)
+ gsub(/:/, empty_str, time_part)
+ time_num = time_part + 0
+ split(date_part, d_parts, \"/\")
+ month_names = \"JanFebMarAprMayJunJulAugSepOctNovDec\"
+ month_num = index(month_names, d_parts[2])
+ if (month_num > 0) {
+ month_num = (month_num + 2) / 3
+ sort_key = sprintf(\"%04d%02d%02d%06d%08d\", d_parts[3], month_num, d_parts[1], time_num, idx)
+ sorted_lines[sort_key] = line
+ } else {
+ sorted_lines[sprintf(\"99999999999999999999%08d\", idx)] = line
+ }
+ } else {
+ sorted_lines[sprintf(\"99999999999999999999%08d\", idx)] = line
+ }
+ idx++
+ }
+ n = asorti(sorted_lines, sorted_keys)
+ for (i = 1; i <= n; i++) {
+ print sorted_lines[sorted_keys[i]]
}
}
- " "$RESULTS_TMP" | sort
+ " "$RESULTS_TMP"
found=1
fi