> #!/usr/bin/perl
>
> my $showme = shift
> or die "Usage: $0 <PATTERN> [FILES]\n";
>
> while (defined(my $line = <>)) {
> $_ .= $line;
> next unless eof; # [1]
>
> my $prefix = ($ARGV eq '-')? '' : "$ARGV: "; # [2]
>
> print "${prefix}$1\n" while /($showme)/mgi;
> $_ = '';
> }
Pretty neat, Steve, thanks. The only thing that'd be nice to fix is making
it so it gives the usage line if you enter:
% showme 'ah\d'
instead of waiting for STDIN. Aside from that it works perfectly. And I
learned a few things in the process.
Thanks again.
- Bryan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]