#!/bin/sh -e

test "$1" || { echo "provide a log file"; exit 1; }

awk '
/^#begin/ { file = $2; next }
/^#end/ { close(file); file = ""; next }
{ print > file }' "$1"

