Linux.com

'Bout time

Posted by: Anonymous Coward on June 01, 2006 06:25 AM
Been in my little toolbag for some years now, and yes, it does come in handy. You get Perl regexps with it too<nobr> <wbr></nobr>;-)
<tt>
#!/usr/bin/perl

# usage: print_match [-e] [files...]

use Getopt::Std;

getopt('e');

$regexp = $opt_e || shift @ARGV;

while () {

        next unless (@matches = m/$regexp/og);


        print join("\n", @matches, '');
}
</tt>
--Just Another Perl Snob

#

Return to GNU grep's new features