NAME

grep-terms - Print lines that match terms

VERSION

This document describes version 0.002 of grep-terms (from Perl distribution App-GrepUtils), released on 2020-11-08.

SYNOPSIS

 % grep-terms [GREP-TERM-OPTIONS]... <TERMS> [GREP-OPTIONS | FILES]...
 % grep-terms --help
 % grep-terms --version|-V

Example:

  % grep-terms "foo bar baz -qux -quux" -i file.txt

will print lines from file.txt that contain "foo", "bar", "baz" (in no particular order) and do not contain "qux" or "quux".

DESCRIPTION

grep-terms is a simple wrapper for Unix command grep. It converts terms (the first argument) like this:

 "foo bar baz -qux -quux"

to:

 -P -e '^(?=.*foo)(?=.*bar)(?=.*baz)(?!.*qux)(?!.*quux)'

It allows searching each term in terms in no particular order and negative search (using the dash prefix syntax). The drawback is that grep won't highlight the terms. Use abgrep for that.

EXIT CODES

0 on success.

255 on I/O error.

99 on command-line options error.

OPTIONS

FAQ

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-GrepUtils.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-GrepUtils.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-GrepUtils

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

abgrep from App::abgrep

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by perlancar@cpan.org.

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