NAME

App::File::Grepper - Greps files for pattern

SYNOPSIS

Runs a File::Find on the specified directories, and greps all text files for a pattern.

use App::File::Grepper;
App::File::Grepper->main( $options, @dirs );

RATIONALE

There are many tools that can do this, e.g. ack. However none of these can call an editor when a file matches the search argument and that is something I often need.

OPTIONS

The first argument to the main() method is a reference to a hash with options.

pattern

The pattern to grep. If it starts with a slash it is interpreted as a perl pattern. Otherwise it is assumed to be a literal text to grep for.

If the text does not contain any uppercase letters, matching will be done case-insensitive unless overridden by option ignorecase.

ignorecase

If defined, matching will be case-insensitive according to the value of ignorecase.

edit-with-emacs

Pass each file where the pattern is found to the emacs editor client.

edit-with-vi

Pass each file where the pattern is found to the vi editor.

view

Pass each file where the pattern is found to the less viewer.

filter

A list of perl patterns to select which files must be processed. Note that these patterns are applied to the basename of each file, not the full path.

exclude

A list of perl patterns to select which files must be rejected. Note that these patterns are applied to the basename of each file, not the full path. Also, these pattern are applied before the filter patterns.

Version control directories RCS, CVS, .svn, .git and .hg are always excluded, as are common editor backups.

AUTHOR

Johan Vromans, <JV at cpan.org>

SUPPORT AND DOCUMENTATION

Development of this module takes place on GitHub: https://github.com/sciurius/perl-App-File-Grepper.

You can find documentation for this module with the perldoc command.

perldoc App::File::Grepper

Please report any bugs or feature requests using the issue tracker on GitHub.

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2012,2016,2022,2026 Johan Vromans, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.