#!/usr/bin/perl $numArgs = $#ARGV + 1; if ($ARGV[0] =~ '-h') { print "Purpose: To make multiple ingrid plots into one overlayed plot\n"; print "Usage: overlay \n"; print "step 1. concatenate your files and save to a file:\n"; print "\t e.g., cat precip.ps sst.ps slp.ps > all.ps \n"; print "step 2. use this perl script to overlay the plots:\n"; print "\t e.g., overlay all.ps allover.ps\n"; } else { if ($numArgs != 2) {print "Usage: overlay \n";exit} $infile = $ARGV[0]; $outfile = $ARGV[1]; open IN, "<$infile" or die $!; open OUT, ">$outfile"; $pr=1; $reset=0; while(){ if ($reset == 1){$reset=0;$pr=1}; chop; my $word = substr $_, 0, 14; # if ($word =~"EndDocument"){$reset=0;$pr=1}; if ($word =~ 'end_sumry_plot') {$pr=0}; if ($word =~ 'start_sumry_pl') {$reset=1}; if ($pr == 0) {next}; print OUT "$_\n"; } print OUT "end_sumry_plot\n"; close(IN); }