summaryrefslogtreecommitdiffstats
path: root/newlog.sh
diff options
context:
space:
mode:
Diffstat (limited to 'newlog.sh')
-rwxr-xr-xnewlog.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/newlog.sh b/newlog.sh
new file mode 100755
index 0000000..160b2a5
--- /dev/null
+++ b/newlog.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+day="$(printf '%02d' "$1")"
+[ -z "$1" ] && day="$(date +%d)"
+
+echo "new log entry for day $day"
+
+tmpf="$(mktemp)"
+
+ed "$tmpf" || {
+ echo "oops, try again"
+ echo "$tmpf"
+ exit 1
+}
+
+ed "decadv-2025.html" << EOF
+/<!--newlog/
++,/-->/-t/-->/
+?h3?s/-xx/-$day/g
+/<p>/r $tmpf
+w
+EOF
+
+rm "$tmpf"