summaryrefslogtreecommitdiff
path: root/summary
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-01-28 21:32:18 +0000
committerJohn Ankarström <john@ankarstrom.se>2021-01-28 21:32:18 +0000
commitf3fd330cddade1c66d0f101d5cc6f657c4cd1bb6 (patch)
tree87ccd4ed6ca757709164615b8cbce92932a96f21 /summary
downloadplan9-f3fd330cddade1c66d0f101d5cc6f657c4cd1bb6.tar.gz
Add various tools
Diffstat (limited to 'summary')
-rwxr-xr-xsummary30
1 files changed, 30 insertions, 0 deletions
diff --git a/summary b/summary
new file mode 100755
index 0000000..b527afd
--- /dev/null
+++ b/summary
@@ -0,0 +1,30 @@
+#!/bin/rc -e
+
+flagfmt='o,h,x,a'
+if(! ifs=() eval `{aux/getflags $*}){
+ aux/usage
+ exit usage
+}
+if(~ $#flago$#flagh$#flagx 000){
+ flago=1
+ flagh=1
+}
+
+cat $home/notes | awk '
+ /^ o / { o = o $0 "\n"; mode = "o"; next } # important
+ /^ - / { h = h $0 "\n"; mode = "h"; next } # normal
+ /^ x / { x = x $0 "\n"; mode = "x"; next } # done
+ /^ / {
+ if (! ENVIRON["flaga"]) next
+ if (mode == "o") o = o $0 "\n"
+ if (mode == "h") h = h $0 "\n"
+ if (mode == "x") x = x $0 "\n"
+ next
+ }
+ { mode = "" }
+ END {
+ if (ENVIRON["flago"]) printf "%s", o
+ if (ENVIRON["flagh"]) printf "%s", h
+ if (ENVIRON["flagx"]) printf "%s", x
+ }
+'