App-Greple
view release on metacpan or search on metacpan
script/greple view on Meta::CPAN
s: statistic information
u: unused options
v: internal match information
=end comment
=item B<--error>=I<action>
As B<greple> tries to read data as a character string, sometimes fails
to convert them into internal representation, and the file is skipped
without processing by default. This works fine to skip binary
data. (B<skip>)
Also sometimes encounters code mapping error due to character
encoding. In this case, reading the file as a binary data helps to
produce meaningful output. (B<retry>)
This option specifies the action when data read error occurred.
=over 4
=item B<skip>
Skip the file. Default.
=item B<retry>
Retry reading the file as a binary data.
=item B<fatal>
Abort the operation.
=item B<ignore>
Ignore error and continue to read anyway.
=back
You may occasionally want to find text in binary data. Next command
will work like L<strings(1)> command.
greple -o --re '(?a)\w{4,}' --error=retry --uc /bin/*
If you want read all files as binary data, use C<--icode=binary>
instead.
=item B<-w>, B<--warn> I<type>=[C<0>,C<1>]
Control runtime message mainly about file operation related to
C<--error> option. Repeatable. Value is optional and 1 is assumed
when omitted. So C<-wall> option is the same as C<-wall=1> and enables
all messages, and C<-wall=0> disables all.
Types are:
=over 4
=item B<read>
(Default 0) Errors occurred during file read. Mainly unicode related
errors when reading binary or ambiguous text file.
=item B<skip>
(Default 1) File skip message.
=item B<retry>
(Default 0) File retry message.
=item B<begin>
(Default 0) When C<--begin> function died with C</^SKIP/i> message,
the file is skipped without any notice. Enables this to see the dying
message.
=item B<all>
Set same value for all types.
=back
=item B<--alert> [ C<size>=#, C<time>=# ]
Set alert parameter for large file. B<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 B<512 * 1024
characters> (I<size>), B<2 seconds> timer will start (I<time>). Alert
message is shown when the timer expired.
To disable this alert, set the size as zero:
--alert size=0
=item B<-Mdebug>, B<-d>I<x>
Debug option is described in L<App::Greple::debug> module.
=back
=head1 ENVIRONMENT and STARTUP FILE
=over 7
=item B<GREPLEOPTS>
Environment variable GREPLEOPTS is used as a default options. They
are inserted before command line options.
=item B<GREPLE_NORC>
If set non-empty string, startup file F<~/.greplerc> is not processed.
=item B<DEBUG_GETOPT>
Enable L<Getopt::Long> debug option.
script/greple view on Meta::CPAN
You can use the module like this:
greple -Mperl --pod default greple
greple -Mperl --colorful --code --comment --pod default greple
If special subroutine C<initialize()> and C<finalize()> are defined in
the module, they are called at the beginning with
L<Getopt::EX::Module> object as a first argument. Second argument is
the reference to C<@ARGV>, and you can modify actual C<@ARGV> using
it. See L<App::Greple::find> module as an example.
Calling sequence is like this. See L<Getopt::EX::Module> for detail.
1) Call initialize()
2) Call function given in -Mmod::func() style
3) Call finalize()
=head1 HISTORY
Most capability of B<greple> is derived from B<mg> command, which has
been developing from early 1990's by the same author. Because modern
standard B<grep> family command becomes to have similar capabilities,
it is a time to clean up entire functionalities, totally remodel the
option interfaces, and change the command name. (2013.11)
=head1 SEE ALSO
L<grep(1)>, L<perl(1)>
L<App::Greple>, L<App::Greple::Grep>
L<https://github.com/kaz-utashiro/greple>
L<Getopt::EX>, L<https://github.com/kaz-utashiro/Getopt-EX>
=head1 AUTHOR
Kazumasa Utashiro
=head1 LICENSE
Copyright 1991-2026 Kazumasa Utashiro
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
# LocalWords: greple egrep foo baz yabba dabba doo ascii greplerc
# LocalWords: regex readlist iname jpg jpeg gif png tbz tgz pdf RGB
# LocalWords: perlre fgrep grep perl joinby KATAKANA InKatakana utf
# LocalWords: nonewline filestyle linestyle chdir mtime nocolor jis
# LocalWords: STDOUT colormap Cyan BLOCKEND LESSANSIENDCHARS setuid
# LocalWords: sprintf regioncolor uniqcolor ansicolor nocolorful jp
# LocalWords: struct sockaddr blockend icode euc shiftjis sjis zcat
# LocalWords: ocode gunzip gpg FILELABEL substr eval misc unicode
# LocalWords: GREPLEOPTS shellwords Katakana builtin pgp autoload
# LocalWords: ENV App ARGV mg Kazumasa Utashiro github colorindex
# LocalWords: matchcount gzipped stdin func CPANMINUS cpanm kana
( run in 0.631 second using v1.01-cache-2.11-cpan-39bf76dae61 )