#!/usr/bin/awk -f # Start of a file entry /= `/ { outfile = gensub("_yaml$", ".yaml", "1", $1) print "Writing " outfile firstline = substr($0, index($0, "`") + 1) if (firstline !~ "^---") firstline = "---\n"firstline print firstline > outfile next } /^`$/ { outfile = "" next } outfile != "" { print >> outfile }