diff options
| author | tslil clingman <> | 2024-02-22 22:45:18 +0100 |
|---|---|---|
| committer | tslil clingman <> | 2024-02-22 22:45:18 +0100 |
| commit | 0130049829d5e6bdd558abe6a490790431435c9c (patch) | |
| tree | 6252e24cf3945fd6216bcd972db6c62e848e5eb4 /update.sh | |
| parent | 9e3a2c8c76835ad883c10943622391a2d4afd539 (diff) | |
use awk to generate indices
Diffstat (limited to 'update.sh')
| -rwxr-xr-x | update.sh | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1,14 +1,17 @@ #!/bin/sh -echo Generating index +GEN_TITLE=' +BEGIN { show = 1; ORS=""; } +/Time-stamp/ { printf("%s - ", substr($2,2)) } +/^# / && show { print substr($0,3); show = 0 }' + +echo Generating index-all.gmi printf "# l-3.space: all\n\nAll content\n" > index-all.gmi for f in log*gmi; do - printf '=> gemini://l-3.space/%s %s - %s\n' \ - $f\ - "$(head -n1 $f | sed 's/Time-stamp: <\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\) ..h.. UTC>/\1/')"\ - "$(grep '^# ' $f | head -n1 | cut -d\ -f2-)"; + printf '=> gemini://l-3.space/%s %s\n' $f "$(awk -- "$GEN_TITLE" $f)" done | sort -r >> index-all.gmi +echo Updating index.gmi ed index.gmi <<EOF /^## Recent posts/+ +,/^## Indices/-2d |
