Skip to content

Instantly share code, notes, and snippets.

@pfeilbr
Created June 7, 2021 14:23
Show Gist options
  • Save pfeilbr/957cec218eb7db4c02579c900c6aa2d0 to your computer and use it in GitHub Desktop.
Save pfeilbr/957cec218eb7db4c02579c900c6aa2d0 to your computer and use it in GitHub Desktop.
markdown notes manipulation
cd notes
for f in *.md; do
first_line=$(head -n 1 $f)
if [[ ! $first_line = \#* ]] ; then
#echo "${f}"
barename=$(basename $f .md)
# echo "${barename}"
# prepend bare filename as H1 to top of note
echo -e "# ${barename}\n\n$(cat $f)" > $f
# cp $f tmp
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment