diff --git a/bin/grep b/bin/grep index 8b07c13b..7baa4a6d 100755 --- a/bin/grep +++ b/bin/grep @@ -54,7 +54,7 @@ use File::Spec; use File::Temp qw(); use Getopt::Std; -our $VERSION = '1.010'; +our $VERSION = '1.011'; $| = 1; # autoflush output @@ -88,7 +88,7 @@ sub VERSION_MESSAGE { sub usage { die <) { + if (defined $opt->{'m'}) { # maximum may be zero + last LINE if $total >= $opt->{'m'}; + } $Matches = 0; ############## @@ -483,8 +488,6 @@ FILE: while ( defined( $file = shift(@_) ) ) { print $opt->{n} ? "$.:" : "", $_, ( $opt->{p} || $opt->{P} ) && ( '-' x 20 ) . "\n"; } - - last LINE if $opt->{'1'}; # single match per file } close $fh; } @@ -510,7 +513,8 @@ grep - search for regular expressions and print =head1 SYNOPSIS -B [ B<-[incCwsxvhHlLF1igurpaqT]> ] [ B<-e> I ] +B [ B<-[incCwsxvhHlLFigurpaqT]> ] [ B<-e> I ] [ B<-m> I ] + [ B<-f> I ] [ B<-P> I ] [ I ] [ I ... ] =head1 DESCRIPTION @@ -533,9 +537,9 @@ The following options are accepted: =over 4 -=item B<-1> +=item B<-m> I -Allow at most one match per file. +Display a maximum of NUM matches per file. =item B<-a>