Newer
Older
labs / unhide.sh
#!/usr/bin/env bash
IFS="
"

if [ $# -eq 0 ]
then
	echo "Unhides a folder of tiddlers.  This removes the 'hidden' tag and the '$:' system title prefix from each tiddler in the folder.  Note that the sript WILL recurse into sub-folders."
	echo
	echo "Usage:  unhide.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: (.*) hidden|tags: \1|' "${f}"
done