#!/usr/bin/perl

foreach $file (@ARGV) {
    $file =~ s/\.gz$//o;

    open(FILE, "gunzip -c $file.gz | ");
    
    while (($line = <FILE>)) {
	if ($line =~ /^%%BoundingBox/) {
	    print $line;
	    open(BBFILE, "> " . $file . ".bb");
	    print BBFILE  ($line . "\n");
	    close(BBFILE);
	    break;
	}
    }

    close(FILE);
}

