#!/usr/local/bin/jperl -- -*-Perl-*- ( @ARGV ) || die "Usage: $0 - \n"; $range = shift; if ( $range =~ m|-| ) { ( $from, $to ) = ( $range =~ m|([^-]*)-([^-]*)| ); $from = 1 unless ( $from ); $from = 1 if ( $from < 1 ); $to = 12 unless ( $to ); $to = 12 if ( $to > 12 ); if ( $from > $to ) { my $swap = $to; $to = $from; $from = $swap; } } else { $from = $to = $range; } while (<>) { if ( m|^\n| ) { if ( $from <= $month && $month <= $to ) { while ( $line = shift( @stack ) ) { print $line; } } elsif ( $month > $to ) { # for faster process exit; } undef @stack; } else { push( @stack, $_ ); if ( m|| ) { ($month,$date) = m|95([0-9][0-9])([0-9][0-9])[A-Z][0-9][0-9]|; $month =~ s|^0||; $date =~ s|^0||; } } }