Miscellaneous small shell scripts that I may or may not need again in the far future.
Beware, all shell code listings here are for zsh on Debian!
You need:
cd into your Dokuwiki installation directoryfor f in $(find data/pages/ -maxdepth 1 -type f) ; do t=$(echo $f | sed -E -e 's#^.+/(.+)\.txt$#\1#' -e 's#_# #g' -e 's#\b.#\u&#g') cp "$f" "$f.backup" sed -i "1i====== $t ======\\n" $f done
find data/pages/ -maxdepth 1 -type f finds all thosesed builds the page title and uses extended regex (-E):s#^.+/(.+)\.txt$#\1# strips .txt from the file names#_# #g replaces underscores with spacess#\b.#\u&#g converts the string to Title Casei) ====== $t ======\\n as the first line (1)find data/pages -maxdepth 1 -type f -name \*.txt.backup -execdir rm \{\} \;Spam logging for analysis, and probably more in the future.