#!/usr/bin/perl

=head1 NAME
pgrep - perl version of grep 

=head1 SYNOPSIS
pgrep <RE> [file]...

=head1 DESCRIPTION
This is a perl-coded version of the usual Unix grep(1) command.   Its
advantage  is that the <RE> regular expression arg is a perl pattern.
If there are no command lines, we read from STDIN, of course.

Which version of perl is used to do the match depends  on  which  you
have  installed in /usr/bin/perl, of course; I recommend upgrading to
version 5 if you haven't already.

=head1 OPTIONS
None yet, but maybe in the future.

=head1 SEE ALSO
	grep(1), egrep(1)

=head1 AUTHOR
  John Chambers <jc@trillian.mit.edu>
=cut

$| = 1;
$re = shift || die "Usage: $0 <RE> file..\n";
for $l (<>) {
	if ($l =~ m/$re/) {
		print $ARGV . ':' . $l;
	}
}
