#!/bin/sh . ./_commands/_extract.sh dir=$1 file=$2 page=${file%.content} echo echo "= $dir/$page.md" echo "Changing content" line_number=$(sed -n "/---/=" "$dir/$page.md" | tail -1) headers=$(sed -n "1,$line_number p" "$dir/$page.md") content=$(cat "$dir/$file") printf "%s\n%s" "$headers" "$content" > "$dir/$page.md"