#!/usr/bin/env bash IFS=" " if [ $# -eq 0 ] then echo "Converts a folder of tiddlers into system/hidden tiddlers so that TiddlyWiki will ignore them (including the build-in search). Note that the script WILL recurse into sub-folders." echo echo "Usage: hide.sh /path/to/folder" exit fi files=$(find $1 -type f -name '*.tid' -or -name '*.meta') for f in ${files} ; do echo "${f}" # add the '$:' system title prefix sed --in-place --regexp-extended --expression='s|title: ([^$].*)|title: $:\1|' "${f}" # add a 'hidden' tag sed --in-place --regexp-extended --expression='s|tags: (.*)|tags: \1 hidden|' "${f}" done