App-Greple

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

a series of 10-line units.

    greple -n --border='(.*\n){1,10}'

You can also define arbitrary complex blocks by writing module or
script.

    greple -Myour_module --block '&your_function' ...

## MATCH AREA CONTROL

Using option `--inside` and `--outside`, you can specify the text
area to be matched.  Next commands search only in mail header and body
area respectively.  In these cases, data block is not changed, so
print lines which contain the pattern in the specified area.

    greple --inside '\A(.+\n)+' pattern

    greple --outside '\A(.+\n)+' pattern

Option `--inside`/`--outside` can be used repeatedly to enhance the
area to be matched.  There are similar options
`--include`/`--exclude`, but they are used to trim down the area.

These four options also take user defined function and any complex
region can be used.

## MODULE AND CUSTOMIZATION

User can define default and original options in `~/.greplerc`.  Next
example enables colored output always, and define new option using
macro processing.

    option default --color=always

    define :re1 complex-regex-1
    define :re2 complex-regex-2
    define :re3 complex-regex-3
    option --newopt --inside :re1 --exclude :re2 --re :re3

Specific set of function and option interface can be implemented as
module.  Modules are invoked by `-M` option immediately after command
name.

For example, **greple** does not have recursive search option, but it
can be implemented by `--readlist` option which accepts target file
list from standard input.  Using **find** module, it can be written
like this:

    greple -Mfind . -type f -- pattern

Also **dig** module implements more complex search.  It can be used as
simple as this:

    greple -Mdig pattern --dig .

but this command is finally translated into following option list.

    greple -Mfind . ( -name .git -o -name .svn -o -name RCS ) -prune -o
        -type f ! -name .* ! -name *,v ! -name *~
        ! -iname *.jpg ! -iname *.jpeg ! -iname *.gif ! -iname *.png
        ! -iname *.tar ! -iname *.tbz  ! -iname *.tgz ! -iname *.pdf
        -print -- pattern

## INCLUDED MODULES

The distribution includes some sample modules.  Read document in each
module for detail.  You can read the document by `--man` option or
[perldoc](https://metacpan.org/pod/perldoc) command.

    greple -Mdig --man

    perldoc App::Greple::dig

When it does not work, use `perldoc App::Greple::dig`.

- **colors**

    Color variation module.
    See [App::Greple::colors](https://metacpan.org/pod/App%3A%3AGreple%3A%3Acolors).

- **find**

    Module to use [find(1)](http://man.he.net/man1/find) command to help recursive search.
    See [App::Greple::find](https://metacpan.org/pod/App%3A%3AGreple%3A%3Afind).

- **dig**

    Module for recursive search using **find** module.  Defines `--dig`,
    `--git` and `--git-r` options. See [App::Greple::dig](https://metacpan.org/pod/App%3A%3AGreple%3A%3Adig).

- **pgp**

    Module to search **pgp** files.
    See [App::Greple::pgp](https://metacpan.org/pod/App%3A%3AGreple%3A%3Apgp).

- **select**

    Module to select files.
    See [App::Greple::select](https://metacpan.org/pod/App%3A%3AGreple%3A%3Aselect).

- **perl**

    Sample module to search from perl source files.
    See [App::Greple::perl](https://metacpan.org/pod/App%3A%3AGreple%3A%3Aperl).

Other modules are available at CPAN, or git repository
[https://github.com/kaz-utashiro/](https://github.com/kaz-utashiro/).

# OPTIONS

## PATTERNS

If no positive pattern option is given (i.e. other than `--not` and
`--may`), **greple** takes the first argument as a search pattern
specified by `--le` option.  All of these patterns can be specified
multiple times.

Command itself is written in Perl, and any kind of Perl style regular
expression can be used in patterns.  See [perlre(1)](http://man.he.net/man1/perlre) for detail.



( run in 1.929 second using v1.01-cache-2.11-cpan-df04353d9ac )