in reply to pattern match -vs- *ix grep
It certainly won't beat /bin/grep in speed, but you can give it cooler regexps. Note that this version takes any number of files as input. And it differs from /bin/grep in one important point: it returns a 0 status even when it finds no matches.#!/usr/bin/env perl use strict; use warnings; die "Usage: blah blah\n" unless @ARGV; my $regex = qr/@{[shift]}/; /$regex/ && print while <>;
Also watch out for regexp characters that have special meaning to the shell.
Update: fixed stray -w in first line.
the lowliest monk
|
|---|