#!/bin/sh VAULT=~/cloud/syncthing/obsidian rg --no-filename '^\s*- \[ ]' "$VAULT" \ | awk ' BEGIN { # initialize "last-tag" # initialize tags assoc array } { # find out tag # remove tag from task text # add task text to assoc array # save last-tag } /^\s+/ { # save under last-tag in assoc array if no tag } END { # group by tag } '