Acme-CPANModules-GrepVariants

 view release on metacpan or  search on metacpan

lib/Acme/CPANModules/GrepVariants.pm  view on Meta::CPAN

package Acme::CPANModules::GrepVariants;

use strict;
use Acme::CPANModulesUtil::Misc;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2025-08-20'; # DATE
our $DIST = 'Acme-CPANModules-GrepVariants'; # DIST
our $VERSION = '0.014'; # VERSION

my $description = <<'MARKDOWN';
This list catalogs various grep-like tools.

**1. Reimplementations**

grep (from <pm:PerlPowerTools>) simply tries to reimplement grep in Perl, as
part of the project to reimplement many Unix utilities in Perl. It has few
practical uses; mainly educational. The portability advantage of Perl is
probably minor as grep and many Unix utilities are now available on other
platforms including Windows.


**2a. Improvements in recursive searching against files**

<prog:ack>. Created in 2005 by Andy Lester, <pm:ack> is the granddaddy of
grep-like programs that try to improve the experience of using grep to search
for text in source code. ack skips VCS directories like `.git` or `.svn`, and
understands file types so it doesn't look into giant `.mp4`s and other binaries
by default. ack has spurred the development of its improvements (mostly in speed
aspect) like The Silver Searcher (`ag`) (implemented in C) or `ripgrep`
(implemented in Rust). `git` also now includes a `git-grep` utility (implemented
in C). ack has a website: <https://beyondgrep.com>. See also
<https://betterthanack.com>.

<prog:gre> (from <pm:App::Gre>) is a "grep clone using Perl regexp's with better
file filtering, defaults, speed, and presentation". It seems to focus on
providing many options to filter files (from including/excluding by file
extension, by matching against filename, by first line, by maximum directory
depth, and so on). It also offers some alternative output styles.


**2b. Improvements in searching for multiple patterns in no particular order**

Normally with the regular grep, to search for all 'foo' and 'bar' *in no
particular order*, you either have to do something like:

    % grep --color=always foo FILES | grep bar

or:

    % grep -P 'foo.*bar|bar.*foo' FILES

both of which get unwieldy if the number of patterns get higher. Or you can use
look-ahead:

    % grep -P '(?=.*foo)(?=.*bar)' FILES

but this does not capture (thus highlight) the patterns. To do that, you can
pipe to grep once more:

    % grep -P '(?=.*foo)(?=.*bar)' FILES | grep -P '(foo|bar)'

but you introduce the complications of double filtering (e.g. filenames in
FILES is now the subject of the second grep).

Note that searching for multiple patterns in particular order ('foo.*bar'), or
searching for aternates from multiple patterns ('foo|bar') is no problem in
grep.

Some tools have been written to make it easier to specify multiple patterns:

<prog:abgrep> (from <pm:App::abgrep>) sports a `--all` option to require all

lib/Acme/CPANModules/GrepVariants.pm  view on Meta::CPAN


<prog:grep-from-ini> (from <pm:App::INIUtils>).

<prog:grep-from-coin> (from <pm:App::CryptoCurrencyUtils>).

<prog:grep-from-exchange> (from <pm:App::CryptoCurrencyUtils>).

<prog:jgrep> (from <pm:App::JsonLogUtils>).

<prog:pdfgrep> (alias: <prog:grep-from-pdf>) (from <pm:App::PDFUtils>) searches
against text in PDF files (it's a wrapper for `pdftotext` utility and grep).

<prog:ptargrep> (from <pm:Archive::Tar>) searches against table of contents of
tar files.


**5a. Variants: searching URLs**

<prog:grep-url> (from <pm:App::grep::url>) greps URLs from lines of input. You
don't have to manually specify regex that matches URLs yourself; you can just
add additional criteria for the URLs, e.g. whether the host part must contain
some text, or whether a certain query parameter must match some pattern.


**5b. Variants: searching dates**

<prog:grep-date> (from L<App::grep::date>) greps for dates in lines of text.

<prog:dategrep> (from L<App::dategrep>) prints lines matching a date range.

MARKDOWN

our $LIST = {
    summary => 'List of grep-like CLI utilities available on CPAN',
    description => $description,
    entries => [
    ],
};

Acme::CPANModulesUtil::Misc::populate_entries_from_module_links_in_description;

1;
# ABSTRACT: List of grep-like CLI utilities available on CPAN

__END__

=pod

=encoding UTF-8

=head1 NAME

Acme::CPANModules::GrepVariants - List of grep-like CLI utilities available on CPAN

=head1 VERSION

This document describes version 0.014 of Acme::CPANModules::GrepVariants (from Perl distribution Acme-CPANModules-GrepVariants), released on 2025-08-20.

=head1 DESCRIPTION

This list catalogs various grep-like tools.

B<1. Reimplementations>

grep (from L<PerlPowerTools>) simply tries to reimplement grep in Perl, as
part of the project to reimplement many Unix utilities in Perl. It has few
practical uses; mainly educational. The portability advantage of Perl is
probably minor as grep and many Unix utilities are now available on other
platforms including Windows.

B<2a. Improvements in recursive searching against files>

L<ack>. Created in 2005 by Andy Lester, L<ack> is the granddaddy of
grep-like programs that try to improve the experience of using grep to search
for text in source code. ack skips VCS directories like C<.git> or C<.svn>, and
understands file types so it doesn't look into giant C<.mp4>s and other binaries
by default. ack has spurred the development of its improvements (mostly in speed
aspect) like The Silver Searcher (C<ag>) (implemented in C) or C<ripgrep>
(implemented in Rust). C<git> also now includes a C<git-grep> utility (implemented
in C). ack has a website: L<https://beyondgrep.com>. See also
L<https://betterthanack.com>.

L<gre> (from L<App::Gre>) is a "grep clone using Perl regexp's with better
file filtering, defaults, speed, and presentation". It seems to focus on
providing many options to filter files (from including/excluding by file
extension, by matching against filename, by first line, by maximum directory
depth, and so on). It also offers some alternative output styles.

B<2b. Improvements in searching for multiple patterns in no particular order>

Normally with the regular grep, to search for all 'foo' and 'bar' I<in no
particular order>, you either have to do something like:

 % grep --color=always foo FILES | grep bar

or:

 % grep -P 'foo.*bar|bar.*foo' FILES

both of which get unwieldy if the number of patterns get higher. Or you can use
look-ahead:

 % grep -P '(?=.*foo)(?=.*bar)' FILES

but this does not capture (thus highlight) the patterns. To do that, you can
pipe to grep once more:

 % grep -P '(?=.*foo)(?=.*bar)' FILES | grep -P '(foo|bar)'

but you introduce the complications of double filtering (e.g. filenames in
FILES is now the subject of the second grep).

Note that searching for multiple patterns in particular order ('foo.*bar'), or
searching for aternates from multiple patterns ('foo|bar') is no problem in
grep.

Some tools have been written to make it easier to specify multiple patterns:

L<abgrep> (from L<App::abgrep>) sports a C<--all> option to require all
patterns to appear in a line (in no particular order). Normally, when multiple
patterns are given (via multiple C<-e> or C<--regexp> options), grep will include



( run in 2.679 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )