#!/bin/awk -f

#
#	Extracts the latest production report from a log
#
#	Variables: out=filename		output file
#		   truncate=1		truncate out if true (one prod report)
#

BEGIN {
  if (out=="") out="prod.report";
}

/> Production Report   dated / {
  if (truncate) close( out );
  print $0 > out;
  prodreport=1;
  next;
}


{
  if (prodreport) print $0 > out;
}

/money delta was \$.[0-9]* for this update/ {
  prodreport=0;
}

