Create a list of subnotes with headlines
Kristoffer Bernssen edited this page Jan 12, 2019
·
3 revisions
Pages 79
Clone this wiki locally
Create a file.sh with the following content:
#!/bin/bash
#print links to subnotes with headlines
DIR=${1%.*}
DIR2=$(sed 's/.*\/[^\/]*\///g' <<<"$DIR")
for file in `find $DIR -type f -printf '%d\t%P\n' | sort -r -nk1 | cut -f2- `
do
echo $DIR2/$file | cut -f 1 -d '.' | sed 's/^/[[/; s/\//:/g; s/$/]]/g';
SUBNOTE=$DIR/$file;
cat $SUBNOTE | pcregrep -o1 -i '^\={1,6}([^=].*[^=])={1,6}$' | perl -ne 'print "*$_"'
done