App-Greple

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


    - **retry**

        Retry reading the file as a binary data.

    - **fatal**

        Abort the operation.

    - **ignore**

        Ignore error and continue to read anyway.

    You may occasionally want to find text in binary data.  Next command
    will work like [strings(1)](http://man.he.net/man1/strings) command.

        greple -o --re '(?a)\w{4,}' --error=retry --uc /bin/*

    If you want read all files as binary data, use `--icode=binary`
    instead.

- **-w**, **--warn** _type_=\[`0`,`1`\]

    Control runtime message mainly about file operation related to
    `--error` option.  Repeatable.  Value is optional and 1 is assumed
    when omitted.  So `-wall` option is the same as `-wall=1` and enables
    all messages, and `-wall=0` disables all.

    Types are:

    - **read**

        (Default 0) Errors occurred during file read.  Mainly unicode related
        errors when reading binary or ambiguous text file.

    - **skip**

        (Default 1) File skip message.

    - **retry**

        (Default 0) File retry message.

    - **begin**

        (Default 0) When `--begin` function died with `/^SKIP/i` message,
        the file is skipped without any notice.  Enables this to see the dying
        message.

    - **all**

        Set same value for all types.

- **--alert** \[ `size`=#, `time`=# \]

    Set alert parameter for large file.  **Greple** scans whole file
    content to know line borders, and it takes several seconds or more if
    it contains large number of lines.

    By default, if the target file contains more than **512 \* 1024
    characters** (_size_), **2 seconds** timer will start (_time_).  Alert
    message is shown when the timer expired.

    To disable this alert, set the size as zero:

        --alert size=0

- **-P**\[_n_\], **--parallel**\[=_n_\]

    (Experimental) Search multiple patterns in parallel using up to _n_
    child processes.  When _n_ is omitted or zero, the number of CPU
    cores is used.  Note that a separate numeric argument following
    **-P** is taken as its value; use the attached form (`-P4`) or `-e`
    to search a numeric pattern.  This is effective when scanning a large file with
    multiple time-consuming patterns.  Function patterns are always
    processed sequentially.  Parallel processing is applied only when the
    target text is larger than 1MB (can be changed by
    `GREPLE_PARALLEL_THRESHOLD` environment variable) and two or more
    eligible patterns exist.

    Also, line border decomposition is performed in another child
    process, overlapping with the rest of the search process.  The child
    process is started when the first match is found, so no extra process
    is created for unmatched files.  This works even with a single search
    pattern.

- **-Mdebug**, **-d**_x_

    Debug option is described in [App::Greple::debug](https://metacpan.org/pod/App%3A%3AGreple%3A%3Adebug) module.

# ENVIRONMENT and STARTUP FILE

- **GREPLEOPTS**

    Environment variable GREPLEOPTS is used as a default options.  They
    are inserted before command line options.

- **GREPLE\_NORC**

    If set non-empty string, startup file `~/.greplerc` is not processed.

- **GREPLE\_PARALLEL\_THRESHOLD**

    Minimum text size to enable parallel pattern matching with the
    **--parallel** option.  Default is 1048576 (1MB).

- **DEBUG\_GETOPT**

    Enable [Getopt::Long](https://metacpan.org/pod/Getopt%3A%3ALong) debug option.

- **DEBUG\_GETOPTEX**

    Enable [Getopt::EX](https://metacpan.org/pod/Getopt%3A%3AEX) debug option.

- **NO\_COLOR**

    If true, all coloring capability with ANSI terminal sequence is
    disabled.  See [https://no-color.org/](https://no-color.org/).

Before starting execution, **greple** reads the file named `.greplerc`
on user's home directory.  Following directives can be used.



( run in 0.632 second using v1.01-cache-2.11-cpan-0b5f733616e )