#!/usr/bin/env python from os import system, symlink system("grep -re '^ -' _posts/*.md | cut -d: -f2 | sort| uniq | grep -v -- '--' | cut -d ' ' -f3- > _tmp/taglist.txt") with open("_tmp/taglist.txt", "r") as tagfh: for tag in (x.strip() for x in tagfh): symlink("_base_tag.md", "_tags/{tag}.md".format(tag=tag))