#!/usr/athena/bin/perl
while (<>) {
	$sawbegin++, last if ($mode,$file) = /^begin\s*(\d*)\s*(\S*)/;
}
die "missing begin" unless $sawbegin;
open(OUT,"> $file") if $file ne "";
while (<>) {
	$sawend++, last if /^end/;
	s/[a-z]+$//; # handle stupid trailing lowercase letters
	next if /[a-z]/;
	next unless int((((ord() - 32) & 077) + 2) / 3) == int(length() / 4);
	print OUT unpack("u", $_);
}
die "missing end" unless $sawend;
chmod oct($mode), $file;
exit 0;
