3 my $pat = shift(@ARGV) || usage
(1);
4 my $infile = shift(@ARGV) || usage
(1);
5 my $outfile = shift(@ARGV) || "-";
6 print STDERR
"Package-strip processing input file $infile\n";
7 print STDERR
"Output to " . ($outfile ne "-" ?
$outfile : "stdout") . "\n";
9 # massage the regexp to accept semi-shell-style *
12 open (I
,"<$infile") || die $@
;
13 open (O
,">>$outfile") || die $@
;
18 my @srclist = split(/\012\012\012/,$srctext);
19 my @outlist = grep(/Package: $pat/,@srclist);
20 print O
join("\012\012\012",@outlist);
21 print O
"\012\012\012";
25 print STDERR
"usage: Package-strip <regexp> <filename> [output filename]\nRemember to escape wildcard characters for the shell.";