File::GrepFind matches to a pattern in a series of files and related functions | |
Download |
File::Grep Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Michael K. Neylon
- Publisher web site:
- http://search.cpan.org/~dmuey/Hash-Merge-0.10/Merge.pm
File::Grep Tags
File::Grep Description
Find matches to a pattern in a series of files and related functions File::Grep is a Perl module to find matches to a pattern in a series of files and related functions.SYNOPSIS use File::Grep qw( fgrep fmap fdo ); # Void context if ( fgrep { /$user/ } "/etc/passwd" ) { do_something(); } # Scalar context print "The index page was hit ", ( fgrep { /index.html/ } glob "/var/log/httpd/access.log.*"), " times "; # Array context my @matches = fgrep { /index.html } glob "/var/log/httpd/access.log.*"; print SUMMARY $_ foreach @matches; # Mapping my @lower = fmap { chomp; lc; } glob "/var/log/httpd/access.log.*"; # Foreach style.. my $count; fdo { $count++ } @filelist; print "Total lines: $count "; # More complex handling my @matchcount; fdo { my ( $file, $pos, $line ) = @_; $matchcount++ if ( $line =~ /keyword/ ); } @filelist;File::Grep mimics the functionality of the grep function in perl, but applying it to files instead of a list. This is similar in nature to the UNIX grep command, but more powerful as the pattern can be any legal perl function. Requirements: · Perl
File::Grep Related Software