#!/bin/sh echo "/:home /projects.html:projects /posts.html:ramblings" | awk ' function normalize(file) { sub(".[^.]*$", "", file) sub(".*/", "", file) return file } { for (i=1; i<=NF; i++) { match($i, /:.+/) name = substr($i, RSTART+1, RLENGTH) match($i, /.+:/) file = substr($i, RSTART, RLENGTH-1) parsed_file = ENVIRON["ZS_FILE"] if (normalize(file) == normalize(parsed_file) || (normalize(parsed_file) == "index" && file == "/")) { name = sprintf("[%s]", name) } printf "
  • %s
  • ", file, name if (i