Skip to content

grep‐like tools

clach04 edited this page Feb 5, 2024 · 3 revisions

Good old grep isn't the only (open source) text (regex) search tool.

Help output from similar tools.

grep

Usage: grep [OPTION]... PATTERN [FILE]...
Search for PATTERN in each FILE or standard input.
PATTERN is, by default, a basic regular expression (BRE).
Example: grep -i 'hello world' menu.h main.c

Regexp selection and interpretation:
  -E, --extended-regexp     PATTERN is an extended regular expression (ERE)
  -F, --fixed-strings       PATTERN is a set of newline-separated strings
  -G, --basic-regexp        PATTERN is a basic regular expression (BRE)
  -P, --perl-regexp         PATTERN is a Perl regular expression
  -e, --regexp=PATTERN      use PATTERN for matching
  -f, --file=FILE           obtain PATTERN from FILE
  -i, --ignore-case         ignore case distinctions
  -w, --word-regexp         force PATTERN to match only whole words
  -x, --line-regexp         force PATTERN to match only whole lines
  -z, --null-data           a data line ends in 0 byte, not newline

Miscellaneous:
  -s, --no-messages         suppress error messages
  -v, --invert-match        select non-matching lines
  -V, --version             display version information and exit
      --help                display this help text and exit

Output control:
  -m, --max-count=NUM       stop after NUM matches
  -b, --byte-offset         print the byte offset with output lines
  -n, --line-number         print line number with output lines
      --line-buffered       flush output on every line
  -H, --with-filename       print the file name for each match
  -h, --no-filename         suppress the file name prefix on output
      --label=LABEL         use LABEL as the standard input file name prefix
  -o, --only-matching       show only the part of a line matching PATTERN
  -q, --quiet, --silent     suppress all normal output
      --binary-files=TYPE   assume that binary files are TYPE;
                            TYPE is 'binary', 'text', or 'without-match'
  -a, --text                equivalent to --binary-files=text
  -I                        equivalent to --binary-files=without-match
  -d, --directories=ACTION  how to handle directories;
                            ACTION is 'read', 'recurse', or 'skip'
  -D, --devices=ACTION      how to handle devices, FIFOs and sockets;
                            ACTION is 'read' or 'skip'
  -r, --recursive           like --directories=recurse
  -R, --dereference-recursive  likewise, but follow all symlinks
      --include=FILE_PATTERN  search only files that match FILE_PATTERN
      --exclude=FILE_PATTERN  skip files and directories matching FILE_PATTERN
      --exclude-from=FILE   skip files matching any file pattern from FILE
      --exclude-dir=PATTERN  directories that match PATTERN will be skipped.
  -L, --files-without-match  print only names of FILEs containing no match
  -l, --files-with-matches  print only names of FILEs containing matches
  -c, --count               print only a count of matching lines per FILE
  -T, --initial-tab         make tabs line up (if needed)
  -Z, --null                print 0 byte after FILE name

Context control:
  -B, --before-context=NUM  print NUM lines of leading context
  -A, --after-context=NUM   print NUM lines of trailing context
  -C, --context=NUM         print NUM lines of output context
  -NUM                      same as --context=NUM
      --color[=WHEN],
      --colour[=WHEN]       use markers to highlight the matching strings;
                            WHEN is 'always', 'never', or 'auto'
  -U, --binary              do not strip CR characters at EOL (MSDOS/Windows)
  -u, --unix-byte-offsets   report offsets as if CRs were not there
                            (MSDOS/Windows)

'egrep' means 'grep -E'.  'fgrep' means 'grep -F'.
Direct invocation as either 'egrep' or 'fgrep' is deprecated.
When FILE is -, read standard input.  With no FILE, read . if a command-line
-r is given, - otherwise.  If fewer than two FILEs are given, assume -h.
Exit status is 0 if any line is selected, 1 otherwise;
if any error occurs and -q is not given, the exit status is 2.

Report bugs to: bug-grep@gnu.org
GNU grep home page: <https://www.gnu.org/software/grep/>
General help using GNU software: <http://www.gnu.org/gethelp/>

ripgrep - rg

ripgrep 13.0.0
Andrew Gallant <jamslam@gmail.com>

ripgrep (rg) recursively searches the current directory for a regex pattern.
By default, ripgrep will respect gitignore rules and automatically skip hidden
files/directories and binary files.

Use -h for short descriptions and --help for more details.

Project home page: https://github.com/BurntSushi/ripgrep


USAGE:
    rg [OPTIONS] PATTERN [PATH ...]
    rg [OPTIONS] -e PATTERN ... [PATH ...]
    rg [OPTIONS] -f PATTERNFILE ... [PATH ...]
    rg [OPTIONS] --files [PATH ...]
    rg [OPTIONS] --type-list
    command | rg [OPTIONS] PATTERN
    rg [OPTIONS] --help
    rg [OPTIONS] --version

ARGS:
    <PATTERN>    A regular expression used for searching.
    <PATH>...    A file or directory to search.

OPTIONS:
    -A, --after-context <NUM>                    Show NUM lines after each match.
        --auto-hybrid-regex                      Dynamically use PCRE2 if necessary.
    -B, --before-context <NUM>                   Show NUM lines before each match.
        --binary                                 Search binary files.
        --block-buffered                         Force block buffering.
    -b, --byte-offset
            Print the 0-based byte offset for each matching line.

    -s, --case-sensitive                         Search case sensitively (default).
        --color <WHEN>                           Controls when to use color.
        --colors <COLOR_SPEC>...                 Configure color settings and styles.
        --column                                 Show column numbers.
    -C, --context <NUM>                          Show NUM lines before and after each match.
        --context-separator <SEPARATOR>          Set the context separator string.
    -c, --count
            Only show the count of matching lines for each file.

        --count-matches
            Only show the count of individual matches for each file.

        --crlf                                   Support CRLF line terminators (useful on Windows).
        --debug                                  Show debug messages.
        --dfa-size-limit <NUM+SUFFIX?>           The upper size limit of the regex DFA.
    -E, --encoding <ENCODING>                    Specify the text encoding of files to search.
        --engine <ENGINE>
            Specify which regexp engine to use. [default: default]

        --field-context-separator <SEPARATOR>    Set the field context separator.
        --field-match-separator <SEPARATOR>      Set the match separator.
    -f, --file <PATTERNFILE>...                  Search for patterns from the given file.
        --files                                  Print each file that would be searched.
    -l, --files-with-matches                     Print the paths with at least one match.
        --files-without-match                    Print the paths that contain zero matches.
    -F, --fixed-strings                          Treat the pattern as a literal string.
    -L, --follow                                 Follow symbolic links.
    -g, --glob <GLOB>...                         Include or exclude files.
        --glob-case-insensitive                  Process all glob patterns case insensitively.
    -h, --help
            Prints help information. Use --help for more details.

        --heading                                Print matches grouped by each file.
    -., --hidden                                 Search hidden files and directories.
        --iglob <GLOB>...                        Include or exclude files case insensitively.
    -i, --ignore-case                            Case insensitive search.
        --ignore-file <PATH>...                  Specify additional ignore files.
        --ignore-file-case-insensitive           Process ignore files case insensitively.
        --include-zero                           Include files with zero matches in summary
    -v, --invert-match                           Invert matching.
        --json                                   Show search results in a JSON Lines format.
        --line-buffered                          Force line buffering.
    -n, --line-number                            Show line numbers.
    -x, --line-regexp                            Only show matches surrounded by line boundaries.
    -M, --max-columns <NUM>                      Don't print lines longer than this limit.
        --max-columns-preview                    Print a preview for lines exceeding the limit.
    -m, --max-count <NUM>                        Limit the number of matches.
        --max-depth <NUM>                        Descend at most NUM directories.
        --max-filesize <NUM+SUFFIX?>             Ignore files larger than NUM in size.
        --mmap                                   Search using memory maps when possible.
    -U, --multiline                              Enable matching across multiple lines.
        --multiline-dotall                       Make '.' match new lines when multiline is enabled.
        --no-config                              Never read configuration files.
    -I, --no-filename                            Never print the file path with the matched lines.
        --no-heading                             Don't group matches by each file.
        --no-ignore                              Don't respect ignore files.
        --no-ignore-dot                          Don't respect .ignore files.
        --no-ignore-exclude                      Don't respect local exclusion files.
        --no-ignore-files                        Don't respect --ignore-file arguments.
        --no-ignore-global                       Don't respect global ignore files.
        --no-ignore-messages                     Suppress gitignore parse error messages.
        --no-ignore-parent                       Don't respect ignore files in parent directories.
        --no-ignore-vcs                          Don't respect VCS ignore files.
    -N, --no-line-number                         Suppress line numbers.
        --no-messages                            Suppress some error messages.
        --no-mmap                                Never use memory maps.
        --no-pcre2-unicode                       Disable Unicode mode for PCRE2 matching.
        --no-require-git                         Do not require a git repository to use gitignores.
        --no-unicode                             Disable Unicode mode.
    -0, --null                                   Print a NUL byte after file paths.
        --null-data                              Use NUL as a line terminator instead of \n.
        --one-file-system
            Do not descend into directories on other file systems.

    -o, --only-matching                          Print only matched parts of a line.
        --passthru                               Print both matching and non-matching lines.
        --path-separator <SEPARATOR>             Set the path separator.
    -P, --pcre2                                  Enable PCRE2 matching.
        --pcre2-version                          Print the version of PCRE2 that ripgrep uses.
        --pre <COMMAND>                          search outputs of COMMAND FILE for each FILE
        --pre-glob <GLOB>...
            Include or exclude files from a preprocessing command.

    -p, --pretty                                 Alias for --color always --heading --line-number.
    -q, --quiet                                  Do not print anything to stdout.
        --regex-size-limit <NUM+SUFFIX?>         The upper size limit of the compiled regex.
    -e, --regexp <PATTERN>...                    A pattern to search for.
    -r, --replace <REPLACEMENT_TEXT>             Replace matches with the given text.
    -z, --search-zip                             Search in compressed files.
    -S, --smart-case                             Smart case search.
        --sort <SORTBY>
            Sort results in ascending order. Implies --threads=1.

        --sortr <SORTBY>
            Sort results in descending order. Implies --threads=1.

        --stats                                  Print statistics about this ripgrep search.
    -a, --text                                   Search binary files as if they were text.
    -j, --threads <NUM>                          The approximate number of threads to use.
        --trim                                   Trim prefixed whitespace from matches.
    -t, --type <TYPE>...                         Only search files matching TYPE.
        --type-add <TYPE_SPEC>...                Add a new glob for a file type.
        --type-clear <TYPE>...                   Clear globs for a file type.
        --type-list                              Show all supported file types.
    -T, --type-not <TYPE>...                     Do not search files matching TYPE.
    -u, --unrestricted                           Reduce the level of "smart" searching.
    -V, --version                                Prints version information
        --vimgrep                                Show results in vim compatible format.
    -H, --with-filename                          Print the file path with the matched lines.
    -w, --word-regexp                            Only show matches surrounded by word boundaries.

the silver searcher - ag

Usage: ag [FILE-TYPE] [OPTIONS] PATTERN [PATH]

  Recursively search for PATTERN in PATH.
  Like grep or ack, but faster.

Example:
  ag -i foo /bar/

Output Options:
     --ackmate            Print results in AckMate-parseable format
  -A --after [LINES]      Print lines after match (Default: 2)
  -B --before [LINES]     Print lines before match (Default: 2)
     --[no]break          Print newlines between matches in different files
                          (Enabled by default)
  -c --count              Only print the number of matches in each file.
                          (This often differs from the number of matching lines)
     --[no]color          Print color codes in results (Enabled by default)
     --color-line-number  Color codes for line numbers (Default: 1;33)
     --color-match        Color codes for result match numbers (Default: 30;43)
     --color-path         Color codes for path names (Default: 1;32)
     --color-win-ansi     Use ansi colors on Windows even where we can use native
                          (pager/pipe colors are ansi regardless) (Default: off)
     --column             Print column numbers in results
     --[no]filename       Print file names (Enabled unless searching a single file)
  -H --[no]heading        Print file names before each file's matches
                          (Enabled by default)
  -C --context [LINES]    Print lines before and after matches (Default: 2)
     --[no]group          Same as --[no]break --[no]heading
  -g --filename-pattern PATTERN
                          Print filenames matching PATTERN
  -l --files-with-matches Only print filenames that contain matches
                          (don't print the matching lines)
  -L --files-without-matches
                          Only print filenames that don't contain matches
     --print-all-files    Print headings for all files searched, even those that
                          don't contain matches
     --[no]numbers        Print line numbers. Default is to omit line numbers
                          when searching streams
  -o --only-matching      Prints only the matching part of the lines
     --print-long-lines   Print matches on very long lines (Default: >2k characters)
     --passthrough        When searching a stream, print all lines even if they
                          don't match
     --silent             Suppress all log messages, including errors
     --stats              Print stats (files scanned, time taken, etc.)
     --stats-only         Print stats and nothing else.
                          (Same as --count when searching a single file)
     --vimgrep            Print results like vim's :vimgrep /pattern/g would
                          (it reports every match on the line)
  -0 --null --print0      Separate filenames with null (for 'xargs -0')

Search Options:
  -a --all-types          Search all files (doesn't include hidden files
                          or patterns from ignore files)
  -D --debug              Ridiculous debugging (probably not useful)
     --depth NUM          Search up to NUM directories deep (Default: 25)
  -f --follow             Follow symlinks
  -F --fixed-strings      Alias for --literal for compatibility with grep
  -G --file-search-regex  PATTERN Limit search to filenames matching PATTERN
     --hidden             Search hidden files (obeys .*ignore files)
  -i --ignore-case        Match case insensitively
     --ignore PATTERN     Ignore files/directories matching PATTERN
                          (literal file/directory names also allowed)
     --ignore-dir NAME    Alias for --ignore for compatibility with ack.
  -m --max-count NUM      Skip the rest of a file after NUM matches (Default: 10,000)
     --one-device         Don't follow links to other devices.
  -p --path-to-ignore STRING
                          Use .ignore file at STRING
  -Q --literal            Don't parse PATTERN as a regular expression
  -s --case-sensitive     Match case sensitively
  -S --smart-case         Match case insensitively unless PATTERN contains
                          uppercase characters (Enabled by default)
     --search-binary      Search binary files for matches
  -t --all-text           Search all text files (doesn't include hidden files)
  -u --unrestricted       Search all files (ignore .ignore, .gitignore, etc.;
                          searches binary and hidden files as well)
  -U --skip-vcs-ignores   Ignore VCS ignore files
                          (.gitignore, .hgignore; still obey .ignore)
  -v --invert-match
  -w --word-regexp        Only match whole words
  -W --width NUM          Truncate match lines after NUM characters
  -z --search-zip         Search contents of compressed (e.g., gzip) files
                          Note that Windows zip files are not supported.

File Types:
The search can be restricted to certain types of files. Example:
  ag --html needle
  - Searches for 'needle' in files with suffix .htm, .html, .shtml or .xhtml.

For a list of supported file types run:
  ag --list-file-types

Input text encoding for non-ASCII text:
  It is dynamically identified among one of these supported encodings:
  o For text piped in via standard input:
    - The current console code page: Code Page 437 = OEM - United States
    - Code Page 65001 = UTF-8
  o For text read from files:
    - The Windows System Code Page: Code Page 1252 = ANSI - Latin I
    - Code Page 65001 = UTF-8
    - Code Page 1200  = UTF-16

Output text encoding:
  Ag.exe behaves the same way as Microsoft's own console tools:
  All output to the console is encoded as UTF-16. This ensures that all Unicode
  characters are displayed correctly, independently of the current code page.
  Output to a pipe or a file is encoded in the current console code page.
  For pipes, this maximizes the chances that characters for your language are
  processed correctly by further commands in the pipe. But for files, this may
  produce unexpected results, as the default console code page is often
  different from the system code page. If you want the output file to be in
  a specific encoding, change the console code page to the encoding you want.
  Internally, ag.exe uses UTF-8 for all text. This may cause options like
  --ackmate, that report character offsets, to produce seemingly incorrect
  results. When using such options, it is necessary to use code page 65001 to
  get correct offsets.

Escape sequences in the PATTERN string: (Except when using -Q|--literal)
  \xXX, \uXXXX & \UXXXXXXXX are converted to the equivalent Unicode character.
  Use option --verbose to display the pattern string generated.
  Caution: \x80 to \x9F are invalid Unicode code points. To search for the Euro
  sign, use either ? or \u20AC, but not \x80, even for CP 1252 files. Likewise,
  to search for all non-ASCII characters, use [^\x00-\x7F], not [\x80-\xFF].

ag was originally created by Geoff Greer. More information, and the latest
release for Unix/Linux, can be found at http://geoff.greer.fm/ag
This version was ported to Windows by Krzysztof Kowalczyk, then significantly
enhanced by Jean-Fran�ois Larvoire. The latest release can be found at
https://github.com/JFLarvoire/the_silver_searcher/releases
You can also install it using the Windows package manager:
winget install "The Silver Searcher"

sift

Usage:
  sift [OPTIONS] PATTERN [FILE|PATH|tcp://HOST:PORT]...
  sift [OPTIONS] [-e PATTERN | -f FILE] [FILE|PATH|tcp://HOST:PORT]...
  sift [OPTIONS] --targets [FILE|PATH]...

Options:
      --binary-skip                          skip files that seem to be binary
  -a, --binary-text                          process files that seem to be
                                             binary as text
      --blocksize=                           blocksize in bytes (with optional
                                             suffix K|M)
      --color                                enable colored output (default:
                                             auto)
      --no-color                             disable colored output
      --conf=FILE                            load config file FILE
  -C, --context=NUM                          show NUM context lines
  -A, --context-after=NUM                    show NUM context lines after match
  -B, --context-before=NUM                   show NUM context lines before match
  -j, --cores=                               limit used CPU Cores (default: 0 =
                                             all)
  -c, --count                                print count of matches per file
      --dirs=GLOB                            recurse only into directories
                                             whose name matches GLOB
      --err-show-line-length                 show all line length errors
      --err-skip-line-length                 skip line length errors
      --exclude-dirs=GLOB                    do not recurse into directories
                                             whose name matches GLOB
  -x, --ext=                                 limit search to specific file
                                             extensions (comma-separated)
  -X, --exclude-ext=                         exclude specific file extensions
                                             (comma-separated)
      --files=GLOB                           search only files whose name
                                             matches GLOB
      --exclude-files=GLOB                   do not select files whose name
                                             matches GLOB while recursing
      --path=PATTERN                         search only files whose path
                                             matches PATTERN
      --ipath=PATTERN                        search only files whose path
                                             matches PATTERN (case insensitive)
      --exclude-path=PATTERN                 do not search files whose path
                                             matches PATTERN
      --exclude-ipath=PATTERN                do not search files whose path
                                             matches PATTERN (case insensitive)
  -t, --type=                                limit search to specific file
                                             types (comma-separated, see
                                             --list-types)
  -T, --no-type=                             exclude specific file types
                                             (comma-separated, see --list-types)
      --add-type=                            add custom type (see --list-types
                                             for format)
      --del-type=                            remove custom type
      --field-sep=                           column separator (default: ":")
  -l, --files-with-matches                   list files containing matches
  -L, --files-without-match                  list files containing no match
      --follow                               follow symlinks
      --git                                  respect .gitignore files and skip
                                             .git directories
      --group                                group output by file (default: off)
      --no-group                             do not group output by file
  -i, --ignore-case                          case insensitive (default: off)
  -I, --no-ignore-case                       disable case insensitive
  -s, --smart-case                           case insensitive unless pattern
                                             contains uppercase characters
                                             (default: off)
  -S, --no-smart-case                        disable smart case
      --no-conf                              do not load config files
  -v, --invert-match                         select non-matching lines
      --limit=NUM                            only show first NUM matches per
                                             file
  -Q, --literal                              treat pattern as literal, quote
                                             meta characters
  -m, --multiline                            multiline parsing (default: off)
  -M, --no-multiline                         disable multiline parsing
      --only-matching                        only show the matching part of a
                                             line
  -o, --output=FILE|tcp://HOST:PORT          write output to the specified file
                                             or network connection
      --output-limit=                        limit output length per found match
      --output-sep=                          output separator (default: "\n")
      --output-unixpath                      output file paths in unix format
                                             ('/' as path separator)
  -e, --regexp=PATTERN                       add pattern PATTERN to the search
  -f, --regexp-file=FILE                     search for patterns contained in
                                             FILE (one per line)
      --print-config                         print config for loaded configs +
                                             given command line arguments
  -q, --quiet                                suppress output, exit with return
                                             code zero if any match is found
  -r, --recursive                            recurse into directories (default:
                                             on)
  -R, --no-recursive                         do not recurse into directories
      --replace=                             replace numbered or named
                                             (?P<name>pattern) capture groups.
                                             Use ${1}, ${2}, $name, ... for
                                             captured submatches
      --filename                             enforce printing the filename
                                             before results (default: auto)
      --no-filename                          disable printing the filename
                                             before results
  -n, --line-number                          show line numbers (default: off)
  -N, --no-line-number                       do not show line numbers
      --column                               show column numbers
      --no-column                            do not show column numbers
      --byte-offset                          show the byte offset before each
                                             output line
      --no-byte-offset                       do not show the byte offset before
                                             each output line
      --stats                                show statistics
      --targets                              only list selected files, do not
                                             search
      --list-types                           list available file types
  -V, --version                              show version and license
                                             information
  -w, --word-regexp                          only match on ASCII word boundaries
      --write-config                         save config for loaded configs +
                                             given command line arguments
  -z, --zip                                  search content of compressed .gz
                                             files (default: off)
  -Z, --no-zip                               do not search content of
                                             compressed .gz files

File Condition options:
      --file-matches=PATTERN                 only show matches if file also
                                             matches PATTERN
      --line-matches=NUM:PATTERN             only show matches if line NUM
                                             matches PATTERN
      --range-matches=X:Y:PATTERN            only show matches if lines X-Y
                                             match PATTERN
      --not-file-matches=PATTERN             only show matches if file does not
                                             match PATTERN
      --not-line-matches=NUM:PATTERN         only show matches if line NUM does
                                             not match PATTERN
      --not-range-matches=X:Y:PATTERN        only show matches if lines X-Y do
                                             not match PATTERN

Match Condition options:
      --preceded-by=PATTERN                  only show matches preceded by
                                             PATTERN
      --followed-by=PATTERN                  only show matches followed by
                                             PATTERN
      --surrounded-by=PATTERN                only show matches surrounded by
                                             PATTERN
      --preceded-within=NUM:PATTERN          only show matches preceded by
                                             PATTERN within NUM lines
      --followed-within=NUM:PATTERN          only show matches followed by
                                             PATTERN within NUM lines
      --surrounded-within=NUM:PATTERN        only show matches surrounded by
                                             PATTERN within NUM lines
      --not-preceded-by=PATTERN              only show matches not preceded by
                                             PATTERN
      --not-followed-by=PATTERN              only show matches not followed by
                                             PATTERN
      --not-surrounded-by=PATTERN            only show matches not surrounded
                                             by PATTERN
      --not-preceded-within=NUM:PATTERN      only show matches not preceded by
                                             PATTERN within NUM lines
      --not-followed-within=NUM:PATTERN      only show matches not followed by
                                             PATTERN within NUM lines
      --not-surrounded-within=NUM:PATTERN    only show matches not surrounded
                                             by PATTERN within NUM lines

Help Options:
  -h, --help                                 Show this help message

ack

Usage: ack [OPTION]... PATTERN [FILES OR DIRECTORIES]

Search for PATTERN in each source file in the tree from the current
directory on down.  If any files or directories are specified, then
only those files and directories are checked.  ack may also search
STDIN, but only if no file or directory arguments are specified,
or if one of them is "-".

Default switches may be specified in an .ackrc file. If you want no dependency
on the environment, turn it off with --noenv.

File select actions:
  -f                            Only print the files selected, without
                                searching.  The PATTERN must not be specified.
  -g                            Same as -f, but only select files matching
                                PATTERN.

File listing actions:
  -l, --files-with-matches      Print filenames with at least one match
  -L, --files-without-matches   Print filenames with no matches
  -c, --count                   Print filenames and count of matching lines

Searching:
  -i, --ignore-case             Ignore case distinctions in PATTERN
  -S, --[no]smart-case          Ignore case distinctions in PATTERN,
                                only if PATTERN contains no upper case.
                                Ignored if -i or -I are specified.
  -I, --no-ignore-case          Turns on case-sensitivity in PATTERN.
                                Negates -i and --smart-case.
  -v, --invert-match            Invert match: select non-matching lines
  -w, --word-regexp             Force PATTERN to match only whole words
  -Q, --literal                 Quote all metacharacters; PATTERN is literal
  --range-start PATTERN         Specify PATTERN as the start of a match range.
  --range-end PATTERN           Specify PATTERN as the end of a match range.
  --match PATTERN               Specify PATTERN explicitly. Typically omitted.

Search output:
  --output=expr                 Output the evaluation of expr for each line
                                (turns off text highlighting)
  -o                            Show only the part of a line matching PATTERN
                                Same as --output='$&'
  --passthru                    Print all lines, whether matching or not
  -m, --max-count=NUM           Stop searching in each file after NUM matches
  -1                            Stop searching after one match of any kind
  -H, --with-filename           Print the filename for each match (default:
                                on unless explicitly searching a single file)
  -h, --no-filename             Suppress the prefixing filename on output
  --[no]column                  Show the column number of the first match

  -A NUM, --after-context=NUM   Print NUM lines of trailing context after
                                matching lines.
  -B NUM, --before-context=NUM  Print NUM lines of leading context before
                                matching lines.
  -C [NUM], --context[=NUM]     Print NUM lines (default 2) of output context.

  --print0                      Print null byte as separator between filenames,
                                only works with -f, -g, -l, -L or -c.

  -s                            Suppress error messages about nonexistent or
                                unreadable files.


File presentation:
  --pager=COMMAND               Pipes all ack output through COMMAND.  For
                                example, --pager="less -R".  Ignored if output
                                is redirected.
  --nopager                     Do not send output through a pager.  Cancels
                                any setting in ~/.ackrc, ACK_PAGER or
                                ACK_PAGER_COLOR.
  --[no]heading                 Print a filename heading above each file's
                                results.  (default: on when used interactively)
  --[no]break                   Print a break between results from different
                                files.  (default: on when used interactively)
  --group                       Same as --heading --break
  --nogroup                     Same as --noheading --nobreak
  -p, --proximate=LINES         Separate match output with blank lines unless
                                they are within LINES lines from each other.
  -P, --proximate=0             Negates --proximate.
  --[no]underline               Print a line of carets under the matched text.
  --[no]color, --[no]colour     Highlight the matching text (default: on unless
                                output is redirected, or on Windows)
  --color-filename=COLOR
  --color-match=COLOR
  --color-colno=COLOR
  --color-lineno=COLOR          Set the color for filenames, matches, line and
                                column numbers.
  --help-colors                 Show a list of possible color combinations.
  --help-rgb-colors             Show a list of advanced RGB colors.
  --flush                       Flush output immediately, even when ack is used
                                non-interactively (when output goes to a pipe or
                                file).


File finding:
  --sort-files                  Sort the found files lexically.
  --show-types                  Show which types each file has.
  --files-from=FILE             Read the list of files to search from FILE.
  -x                            Read the list of files to search from STDIN.

File inclusion/exclusion:
  --[no]ignore-dir=name         Add/remove directory from list of ignored dirs
  --[no]ignore-directory=name   Synonym for ignore-dir
  --ignore-file=FILTER:ARGS     Add filter for ignoring files.
  -r, -R, --recurse             Recurse into subdirectories (default: on)
  -n, --no-recurse              No descending into subdirectories
  --[no]follow                  Follow symlinks.  Default is off.

File type inclusion/exclusion:
  -t X, --type=X                Include only X files, where X is a filetype,
                                e.g. python, html, markdown, etc
  -T X, --type=noX              Exclude X files, where X is a filetype.
  -k, --known-types             Include only files of types that ack recognizes.
  --help-types                  Display all known types, and how they're defined.

File type specification:
  --type-set=TYPE:FILTER:ARGS   Files with the given ARGS applied to the given
                                FILTER are recognized as being of type TYPE.
                                This replaces an existing definition for TYPE.
  --type-add=TYPE:FILTER:ARGS   Files with the given ARGS applied to the given
                                FILTER are recognized as being type TYPE.
  --type-del=TYPE               Removes all filters associated with TYPE.

Miscellaneous:
  --version                     Display version & copyright
  --[no]env                     Ignore environment variables and global ackrc
                                files.  --env is legal but redundant.
  --ackrc=filename              Specify an ackrc file to use
  --ignore-ack-defaults         Ignore default definitions included with ack.
  --create-ackrc                Outputs a default ackrc for your customization
                                to standard output.
  --dump                        Dump information on which options are loaded
                                and where they're defined.
  --[no]filter                  Force ack to treat standard input as a pipe
                                (--filter) or tty (--nofilter)
  --help                        This help
  --man                         Print the manual.
  --help-types                  Display all known types, and how they're defined.
  --help-colors                 Show a list of possible color combinations.
  --help-rgb-colors             Show a list of advanced RGB colors.
  --thpppt                      Bill the Cat
  --bar                         The warning admiral
  --cathy                       Chocolate! Chocolate! Chocolate!

Filter specifications:
    If FILTER is "ext", ARGS is a list of extensions checked against the
        file's extension.
    If FILTER is "is", ARGS must match the file's name exactly.
    If FILTER is "match", ARGS is matched as a case-insensitive regex
        against the filename.
    If FILTER is "firstlinematch", ARGS is matched as a regex the first
        line of the file's contents.

Exit status is 0 if match, 1 if no match.

ack's home page is at https://beyondgrep.com/

The full ack manual is available by running "ack --man".

This is version v3.5.0 of ack.  Run "ack --version" for full version info.

pss

Usage: pss [options] <pattern> [files]

Search for the pattern in each source file, starting with the current
directory and its sub-directories, recursively. If [files] are specified, only
these files/directories are searched.  Only files with known extensions are
searched, and this can be configured by providing --<type> options. For
example, --python will search all Python files, and "--lisp --scheme" will
search all Lisp and all Scheme files. By default, all known file types are
searched.  Run with --help-types for more help on how to select file types.

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  --help-types          Display supported file types

  Searching:
    -i, --ignore-case   Ignore case distinctions in the pattern
    --smart-case        Ignore case distinctions in the pattern, only if the
                        pattern contains no upper case. Ignored if -i is
                        specified
    -v, --invert-match  Invert match: show non-matching lines
    -w, --word-regexp   Force the pattern to match only whole words
    -Q, --literal       Quote all metacharacters; the pattern is literal
    -U, --universal-newlines
                        Use PEP 278 universal newline support when opening
                        files

  Search output:
    --match=PATTERN     Specify the search pattern explicitly
    -m NUM, --max-count=NUM
                        Stop searching in each file after NUM matches
    --with-filename     Print the filename before matches (default). If
                        --noheading is specified, the filename will be
                        prepended to each matching line. Otherwise it is
                        printed once for all the matches in the file.
    --no-filename       Suppress printing the filename before matches
    --line              Print the line number before matches (default)
    --noline            Suppress printing the line number before matches
    --column            Show the column number of the first match
    --nocolumn          Suppress showing the column number of the first match
                        (default)
    -A NUM, --after-context=NUM
                        Print NUM lines of context after each match
    -B NUM, --before-context=NUM
                        Print NUM lines of context before each match
    -C NUM, --context=NUM
                        Print NUM lines of context before and after each match
    --color             Highlight the matching text
    --nocolor           Do not highlight the matching text (this is the
                        default when output is redirected)
    --color-match=FORE,BACK,STYLE
                        Set the color for matches
    --color-filename=FORE,BACK,STYLE
                        Set the color for emitted filenames
    --color-lineno=FORE,BACK,STYLE
                        Set the color for line numbers
    --nobreak           Print no break between results from different files
    --noheading         Print no file name heading above each file's results

  File finding:
    -f                  Only print the names of found files. The pattern must
                        not be specified
    -g REGEX            Same as -f, but only print files matching REGEX
    -l, --files-with-matches
                        Only print the names of found files that have matches
                        for the pattern
    -L, --files-without-matches
                        Only print the names of found files that have no
                        matches for the pattern

  File inclusion/exclusion:
    -a, --all-types     All file types are searched
    -u, --unrestricted  All files are searched, including those in ignored
                        directories
    --ignore-dir=name   Add directory to the list of ignored dirs
    --noignore-dir=name
                        Remove directory from the list of ignored dirs
    -r, -R, --recurse   Recurse into subdirectories (default)
    -n, --no-recurse    Do not recurse into subdirectories
    -t, --textonly, --nobinary
                        Restrict the search to only textual files.
                        Warning: with this option the search is likely to run
                        much slower
    -G REGEX, --include-pattern=REGEX
                        Only search files that match REGEX
    --exclude-pattern=REGEX
                        Exclude files that match REGEX

By default, the following directories and everything below them is
ignored:

     .Rhistory     .Rproj.user   .bzr          .cdv          
     .cover        .git          .hg           .metadata     
     .pc           .svn          .tox          CVS           
     RCS           SCCS          __pycache__   _build        
     _darcs        _sgbak        blib          cover_db      
     node_modules  ~.dep         ~.dot         ~.nib         
     ~.plst       

To manually control which directories are ignored, use the --ignore-dir
and --noignore-dir options. Specify --unrestricted if you don't want any
directory to be ignored.

Additionally, files matching these (regexp) patterns are ignored:

      #.+#$
      ~$
      core\.\d+$
      [._].*\.swp$

pss version 1.44
Clone this wiki locally