#!/usr/local/bin/perl -s
# most of egrep, except the line-length bugs
$regX = $ARGV[0];
shift;

#
# build the expression
@regX = split('\|',$regX);
$opt = $i ? "oi" : "o";
$" = "/$opt||/";
$regX = "(/@regX/$opt)";
if ($v) {$regX = "!$regX";}

#
# build the print command
$prnt = $#ARGV>0 ? 'printf "%s:$_\n",$ARGV;' : 'print "$_\n";';

#
# put 'em together
$cmd = "while (\<\>) {chop; if ($regX) {$prnt}}";

#
# and run it
eval($cmd);
