{"id":13423612,"url":"https://github.com/Genivia/ugrep","last_synced_at":"2025-03-15T17:32:05.298Z","repository":{"id":37850389,"uuid":"183980799","full_name":"Genivia/ugrep","owner":"Genivia","description":"🔍 ugrep 7.3 file pattern searcher -- a more powerful, ultra fast, user-friendly, compatible grep replacement. Includes a TUI, Google-like Boolean search with AND/OR/NOT, fuzzy search, hexdumps, searches (nested) archives (zip, 7z, tar, pax, cpio), compressed files (gz, Z, bz2, lzma, xz, lz4, zstd, brotli), pdfs, docs, and more","archived":false,"fork":false,"pushed_at":"2025-03-10T14:40:02.000Z","size":145548,"stargazers_count":2762,"open_issues_count":2,"forks_count":116,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-03-11T13:17:31.836Z","etag":null,"topics":["code-search","file-indexing","file-search","fuzzy-search","grep","hexdump","interactive","recursively-search","regex","ripgrep","search","silver-searcher","tar","tui","unicode","zip"],"latest_commit_sha":null,"homepage":"https://ugrep.com","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Genivia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-29T01:42:38.000Z","updated_at":"2025-03-10T14:40:07.000Z","dependencies_parsed_at":"2023-02-16T22:45:52.800Z","dependency_job_id":"35ad1ddf-08d0-47f7-84e4-82d062646657","html_url":"https://github.com/Genivia/ugrep","commit_stats":{"total_commits":764,"total_committers":45,"mean_commits":"16.977777777777778","dds":0.4515706806282722,"last_synced_commit":"09afeb5a3450a6e014f808be6b53f26bb92fc89a"},"previous_names":[],"tags_count":196,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genivia%2Fugrep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genivia%2Fugrep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genivia%2Fugrep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genivia%2Fugrep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Genivia","download_url":"https://codeload.github.com/Genivia/ugrep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243767049,"owners_count":20344861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-search","file-indexing","file-search","fuzzy-search","grep","hexdump","interactive","recursively-search","regex","ripgrep","search","silver-searcher","tar","tui","unicode","zip"],"created_at":"2024-07-31T00:00:38.821Z","updated_at":"2025-03-15T17:32:05.211Z","avatar_url":"https://github.com/Genivia.png","language":"C++","readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/Genivia/ugrep/actions/workflows/c-cpp.yml\"\u003e\u003cimg src=\"https://github.com/Genivia/ugrep/actions/workflows/c-cpp.yml/badge.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opensource.org/licenses/BSD-3-Clause\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-BSD%203--Clause-blue.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eThe ugrep file pattern searcher\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n[ \u003cb\u003eREADME\u003c/b\u003e | \u003ca href=\"https://ugrep.com\"\u003eUser\u0026nbsp;Guide\u003c/a\u003e | \u003ca href=\"https://github.com/Genivia/ugrep-indexer\"\u003eIndexing\u003c/a\u003e | \u003ca href=\"https://github.com/Genivia/ugrep-benchmarks\"\u003eBenchmarks\u003c/a\u003e | \u003ca href=\"https://github.com/Genivia/ugrep/discussions/categories/q-a\"\u003eQ\u0026amp;A\u003c/a\u003e ]\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cimg src=\"https://www.genivia.com/images/scranim.gif\" width=\"438\" alt=\"\"\u003e\n\u003cbr\u003e\n\u003ci\u003eoption -Q opens a query TUI to search files as you type!\u003c/i\u003e\n\u003c/p\u003e\n\nWhy use ugrep?\n--------------\n\n- ugrep is fast, user-friendly, and equipped with a ton of new features that users wanted\n\n- includes an interactive TUI with built-in help, Google-like search with AND/OR/NOT patterns, fuzzy search, search (nested) zip/7z/tar/pax/cpio archives, tarballs and compressed files gz/Z/bz/bz2/lzma/xz/lz4/zstd/brotli, search and hexdump binary files, search documents such as PDF, doc, docx, and output in JSON, XML, CSV or your own customized format\n\n- Unicode extended regex pattern syntax with multi-line pattern matching without requiring special command-line options\n\n- includes a file indexer to speed up searching slow and cold file systems\n\n- a true drop-in replacement for GNU grep (assuming you [copy or symlink `ug` to `grep`, and to `egrep` and to `fgrep`](#grep)), unlike other popular grep claiming to be \"grep alternatives\" or \"replacements\" when those actually implement incompatible command-line options and use an incompatible regex matcher, i.e. Perl regex only versus POSIX BRE (grep) and ERE (egrep) when ugrep supports all regex modes\n\n- benchmarks show that [ugrep is (one of) the fastest grep](https://github.com/Genivia/ugrep-benchmarks) using the high-performance DFA-based regex matcher [RE/flex](https://github.com/Genivia/RE-flex)\n\nDevelopment roadmap\n-------------------\n\n*if something should be improved or added to ugrep, then let me know!*\n\n- #1 priority is quality assurance to continue to make sure ugrep has no bugs and is reliable\n\n- make ugrep run even faster, see for example [#432](https://github.com/Genivia/ugrep/issues/432), [#421](https://github.com/Genivia/ugrep/issues/421)\n\n- share [reproducible performance results](https://github.com/Genivia/ugrep-benchmarks)\n\nOverview\n--------\n\n### Commands\n\n- `ug` is for interactive use, which loads an optional .ugrep configuration file with your preferences located in the working directory or home directory, `ug+` also searches pdfs, documents, e-books, image metadata\n\n- `ugrep` for batch use like GNU grep without a .ugrep configuration file, `ugrep+` also searches pdfs, documents, e-books, image metadata\n\n### What does ugrep add that GNU grep does not support?\n\n- Matches Unicode patterns by default and automatically searches UTF-8, UTF-16 and UTF-32 encoded files\n\n- Matches multiple lines with `\\n` or `\\R` in regex patterns, *no special options are required to do so!*\n\n- Built-in help: `ug --help`, where `ug --help WHAT` displays options related to `WHAT` you are looking for\n\n  💡 `ug --help regex`, `ug --help globs`, `ug --help fuzzy`, `ug --help format`.\n\n- User-friendly with customizable [configuration files](#config) used by the `ug` command intended for interactive use that loads a .ugrep configuration file with your preferences\n\n      ug PATTERN ...                         ugrep --config PATTERN ...\n\n  💡 `ug --save-config ...options-you-want-to-save...` saves a .ugrep config file in the working directory so that the next time you run `ug` there it uses these options.  Do this in your home directory to save a .ugrep config file with options you generally want to use.\n\n- Interactive [query TUI](#query), press F1 or CTRL-Z for help and TAB/SHIFT-TAB to navigate to dirs and files\n\n      ug -Q                                  ug -Q -e PATTERN\n\n  💡 `-Q` replaces `PATTERN` on the command line to let you enter patterns interactively in the TUI.  In the TUI use ALT+letter keys to toggle short \"letter options\" on/off, for example ALT-n (option `-n`) to show/hide line numbers.\n\n- Search the contents of [archives](#archives) (zip, tar, pax, jar, cpio, 7z) and [compressed files](#archives) (gz, Z, bz, bz2, lzma, xz, lz4, zstd, brotli)\n\n      ug -z PATTERN ...                      ug -z --zmax=2 PATTERN ...\n\n  💡 specify `-z --zmax=2` to search compressed files and archives nested within archives.  The `--zmax` argument may range from 1 (default) to 99 for up to 99 decompression and de-archiving steps to search nested archives\n\n- Search with Google-like [Boolean query patterns](#bool) using `-%` patterns with `AND` (or just space), `OR` (or a bar `|`), `NOT` (or a dash `-`), using quotes to match exactly, and grouping with `( )` (shown on the left side below); or with options `-e` (as an \"or\"), `--and`, `--andnot`, and `--not` regex patterns (shown on the right side below):\n\n      ug -% 'A B C' ...                      ug -e 'A' --and 'B' --and 'C' ...\n      ug -% 'A|B C' ...                      ug -e 'A' -e 'B' --and 'C' ...\n      ug -% 'A -B -C' ...                    ug -e 'A' --andnot 'B' --andnot 'C' ...\n      ug -% 'A -(B|C)'...                    ug -e 'A' --andnot 'B' --andnot 'C' ...\n      ug -% '\"abc\" \"def\"' ...                ug -e '\\Qabc\\E' --and '\\Qdef\\E' ...\n\n  where `A`, `B` and `C` are arbitrary regex patterns (use option `-F` to search strings)\n\n  💡 specify option `-%%` (`--bool --files`) to apply the Boolean query to files as a whole: a file matches if all Boolean conditions are satisfied by matching patterns file-wide.  Otherwise, Boolean conditions apply to single lines by default, since grep utilities are generally line-based pattern matchers.  Option `--stats` displays the query in human-readable form after the search completes.\n\n- Search pdf, doc, docx, e-book, and more with `ug+` [using filters](#filter) associated with filename extensions:\n\n      ug+ PATTERN ...\n\n  or specify `--filter` with a file type to use a filter utility:\n\n      ug --filter='pdf:pdftotext % -' PATTERN ...\n      ug --filter='doc:antiword %' PATTERN ...\n      ug --filter='odt,docx,epub,rtf:pandoc --wrap=preserve -t plain % -o -' PATTERN ...\n      ug --filter='odt,doc,docx,rtf,xls,xlsx,ppt,pptx:soffice --headless --cat %' PATTERN ...\n      ug --filter='pem:openssl x509 -text,cer,crt,der:openssl x509 -text -inform der' PATTERN ...\n      ug --filter='latin1:iconv -f LATIN1 -t UTF-8' PATTERN ...\n\n  💡 the `ug+` command is the same as the `ug` command, but also uses filters to search PDFs, documents, and image metadata\n\n- Display horizontal context with option `-o` (`--only-matching`) and context options `-ABC`, e.g. to find matches in very long lines, such as Javascript and JSON sources:\n\n      ug -o -C20 -nk PATTERN longlines.js\n\n  💡 `-o -C20` fits all matches with context in 20 characters before and 20 charactess after a match (i.e. 40 Unicode characters total), `-nk` outputs line and column numbers.\n\n- Find approximate pattern matches with [fuzzy search](#fuzzy), within the specified Levenshtein distance\n\n      ug -Z PATTERN ...                      ug -Z3 PATTTERN ...\n\n  💡 `-Zn` matches up to `n` extra, missing or replaced characters, `-Z+n` matches up to `n` extra characters, `-Z-n` matches with up to `n` missing characters and `-Z~n` matches up to `n` replaced characters.  `-Z` defaults to `-Z1`.\n\n- Fzf-like search with regex (or fixed strings with `-F`), fuzzy matching with up to 4 extra characters with `-Z+4` and words only with `-w`, using `-%%` for file-wide Boolean searches\n\n      ug -Q -%% -l -w -Z+4 --sort=best\n\n  💡 `-l` lists the matching files in the TUI, press `TAB` then `ALT-y` to view a file, `SHIFT-TAB` and `Alt-l` to go back to view the list of matching files ordered by best match\n\n- Search [binary files](#binary) and display hexdumps with binary pattern matches (Unicode text or `-U` for byte patterns)\n\n      ug --hexdump -U BYTEPATTERN ...        ug --hexdump TEXTPATTERN ...\n      ug -X -U BYTEPATTERN ...               ug -X TEXTPATTERN ...\n      ug -W -U BYTEPATTERN ...               ug -W TEXTPATTERN ...\n\n  💡 `--hexdump=4chC1` displays `4` columns of hex without a character column `c`, no hex spacing `h`, and with one extra hex line `C1` before and after a match.\n\n- Include files to search by [file types or file \"magic bytes\"](#magic) or exclude them with `^`\n\n      ug -t TYPE PATTERN ...                 ug -t ^TYPE PATTERN ...\n      ug -M 'MAGIC' PATTERN ...              ug -M '^MAGIC' PATTERN ...\n\n- Include files and directories to search that match [gitignore-style globs](#globs) or exclude them with `^`\n\n      ug -g 'FILEGLOB' PATTERN ...           ug -g '^FILEGLOB' PATTERN ...\n      ug -g 'DIRGLOB/' PATTERN ...           ug -g '^DIRGLOB/' PATTERN ...\n      ug -g 'PATH/FILEGLOB' PATTERN ...      ug -g '^PATH/FILEGLOB' PATTERN ...\n      ug -g 'PATH/DIRGLOB/' PATTERN ...      ug -g '^PATH/DIRGLOB/' PATTERN ...\n\n- Include files to search by [filename extensions](#magic) (suffix) or exclude them with `^`, a shorthand for `-g\"*.EXT\"`\n\n      ug -O EXT PATTERN ...                  ug -O ^EXT PATTERN ...\n\n- Include [hidden files (dotfiles) and directories](#hidden) to search (omitted by default)\n\n      ug -. PATTERN ...                      ug -g'.*,.*/' PATTERN ...\n\n  💡 specify `hidden` in your .ugrep to always search hidden files with `ug`.\n\n- Exclude files specified by [.gitignore](#ignore) etc.\n\n      ug --ignore-files PATTERN ...          ug --ignore-files=.ignore PATTERN ...\n\n  💡 specify `ignore-files` in your .ugrep to always ignore them with `ug`.  Add additional `ignore-files=...` as desired.\n\n- Search patterns excluding [negative patterns](#not) (\"match this but not that\")\n\n      ug -e PATTERN -N NOTPATTERN ...        ug -e '[0-9]+' -N 123 ...\n\n- Use [predefined regex patterns](#source) to search source code, javascript, XML, JSON, HTML, PHP, markdown, etc.\n\n      ug PATTERN -f c++/zap_comments -f c++/zap_strings ...\n      ug PATTERN -f php/zap_html ...\n      ug -f js/functions ... | ug PATTERN ...\n\n- Sort matching files by [name, best match, size, and time](#sort)\n\n      ug --sort PATTERN ...                  ug --sort=size PATTERN ...\n      ug --sort=changed PATTERN ...          ug --sort=created PATTERN ...\n      ug -Z --sort=best PATTERN ...          ug --no-sort PATTERN ...\n\n- Output results in [CSV, JSON, XML](#json), and [user-specified formats](#format)\n\n      ug --csv PATTERN ...                   ug --json PATTERN ...\n      ug --xml PATTERN ...                   ug --format='file=%f line=%n match=%O%~' PATTERN ...\n\n  💡 `ug --help format` displays help on format `%` fields for customized output.\n\n- Search with PCRE's Perl-compatible regex patterns and display or replace [subpattern matches](#replace)\n\n      ug -P PATTERN ...                      ug -P --format='%1 and %2%~' 'PATTERN(SUB1)(SUB2)' ...\n\n- Replace patterns in the output with [-P and --replace](#replace) replacement text, optionally containing `%` [formatting fields](#format), using `-y` to pass the rest of the file through:\n\n      ug --replace='TEXT' PATTERN ...        ug -y --replace='TEXT' PATTERN ...\n      ug --replace='(%m:%o)' PATTERN ...     ug -y --replace='(%m:%o)' PATTERN ...\n      ug -P --replace='%1' PATTERN ...       ug -y -P --replace='%1' PATTERN ...\n\n  💡 `ug --help format` displays help on format `%` fields to optionally use with `--replace`.\n\n- Search files with a specific [encoding](#encoding) format such as ISO-8859-1 thru 16, CP 437, CP 850, MACROMAN, KOI8, etc.\n\n      ug --encoding=LATIN1 PATTERN ...\n\n\u003ca name=\"toc\"/\u003e\n\nTable of contents\n-----------------\n\n- [How to install](#install)\n- [Performance comparisons](#speed)\n- [Using ugrep within Vim](#vim)\n- [Using ugrep within Emacs](#emacs)\n- [Using ugrep to replace GNU/BSD grep](#grep)\n  - [Equivalence to GNU/BSD grep](#equivalence)\n  - [Short and quick command aliases](#aliases)\n  - [Notable improvements over grep](#improvements)\n- [Tutorial](#tutorial)\n  - [Examples](#examples)\n  - [Advanced examples](#advanced)\n  - [Displaying helpful info](#help)\n  - [Configuration files](#config)\n  - [Interactive search with -Q](#query)\n  - [Recursively list matching files with -l, -R, -r, --depth, -g, -O, and -t](#recursion)\n  - [Boolean query patterns with -%, -%%, --and, --not](#bool)\n  - [Search this but not that with -v, -e, -N, -f, -L, -w, -x](#not)\n  - [Search non-Unicode files with --encoding](#encoding)\n  - [Matching multiple lines of text](#multiline)\n  - [Displaying match context with -A, -B, -C, and -y](#context)\n  - [Searching source code using -f, -O, and -t](#source)\n  - [Searching compressed files and archives with -z](#archives)\n  - [Find files by file signature and shebang \"magic bytes\" with -M, -O and -t](#magic)\n  - [Fuzzy search with -Z](#fuzzy)\n  - [Search hidden files with -.](#hidden)\n  - [Using filter utilities to search documents with --filter](#filter)\n  - [Searching and displaying binary files with -U, -W, and -X](#binary)\n  - [Ignore binary files with -I](#nobinary)\n  - [Ignoring .gitignore-specified files with --ignore-files](#ignore)\n  - [Using gitignore-style globs to select directories and files to search](#globs)\n  - [Including or excluding mounted file systems from searches](#fs)\n  - [Counting the number of matches with -c and -co](#count)\n  - [Displaying file, line, column, and byte offset info with -H, -n, -k, -b, and -T](#fields)\n  - [Displaying colors with --color and paging the output with --pager](#color)\n  - [Output matches in JSON, XML, CSV, C++](#json)\n  - [Customize output with --format](#format)\n  - [Replacing matches with -P --replace and --format using backreferences](#replace)\n  - [Limiting the number of matches with -1,-2...-9, -K, -m, and --max-files](#max)\n  - [Matching empty patterns with -Y](#empty)\n  - [Case-insensitive matching with -i and -j](#case)\n  - [Sort files by name, best match, size, and time](#sort)\n  - [Tips for advanced users](#tips)\n  - [More examples](#more)\n- [Man page](#man)\n- [Regex patterns](#patterns)\n  - [POSIX regular expression syntax](#posix-syntax)\n  - [POSIX and Unicode character classes](#posix-classes)\n  - [POSIX and Unicode character categories](#posix-categories)\n  - [Perl regular expression syntax](#perl-syntax)\n- [Troubleshooting](#bugs)\n\n\u003ca name=\"install\"/\u003e\n\nHow to install\n--------------\n\n### MacOS\n\nInstall the latest ugrep with [Homebrew](https://brew.sh):\n\n    $ brew install ugrep\n\nor install with [MacPorts](https://www.macports.org):\n\n    $ sudo port install ugrep\n\nThis installs the `ugrep` and `ug` commands, where `ug` is the same as `ugrep`\nbut also loads the configuration file .ugrep when present in the working\ndirectory or home directory.\n\n### Windows\n\nInstall with [Winget](https://learn.microsoft.com/en-us/windows/package-manager/)\n`winget install Genivia.ugrep`\n\nOr install with [Chocolatey](https://community.chocolatey.org/packages/ugrep)\n`choco install ugrep`\n\nOr install with [Scoop](https://scoop.sh) `scoop install ugrep`\n\nOr download the full-featured `ugrep.exe` executable as release artifact from\n\u003chttps://github.com/Genivia/ugrep/releases\u003e.  The zipped release contains the\nmain `ugrep.exe` binary as well as `ug.exe`. The `ug` command, intended for \ninteractive use, loads and reads in settings from the _`.ugrep`_ configuration \nfile (when present in the working directory or home directory).\n\nAdd `ugrep.exe` and `ug.exe` to your execution path: go to *Settings* and\nsearch for \"Path\" in *Find a Setting*.  Select *environment variables* -\u003e\n*Path* -\u003e *New* and add the directory where you placed the `ugrep.exe` and\n`ug.exe` executables.\n\n\n\u003e[!TIP]\n\u003e _Practical hints on using `ugrep.exe` and `ug.exe` on the Windows command line:_\n\u003e\n\u003e- when quoting patterns and arguments on the command line, do not use single\n\u003e`'` quotes but use `\"` instead; most Windows command utilities consider\n\u003ethe single `'` quotes part of the command-line argument!\n\u003e- file and directory globs are best specified with option `-g/GLOB` instead of\n\u003ethe usual `GLOB` command line arguments to select files and directories to\n\u003esearch, especially for recursive searches;\n\u003e- when specifying an empty pattern `\"\"` to match all input, this may be ignored\n\u003eby some Windows command interpreters such as Powershell, in that case you\n\u003emust specify option `--match` instead;\n\u003e- to match newlines in patterns, you may want to use `\\R` instead of `\\n` to\n\u003ematch any Unicode newlines, such as `\\r\\n` pairs and single `\\r` and `\\n`.\n\n### Alpine Linux\n\n    $ apk add ugrep ugrep-doc\n\nCheck \u003chttps://pkgs.alpinelinux.org/packages?name=ugrep\u003e for version info.\n\n### Arch Linux\n\n    $ pacman -S ugrep\n\nCheck \u003chttps://archlinux.org/packages/extra/x86_64/ugrep\u003e for version info.\n\n### CentOS\n\nFirst enable the [EPEL repository](https://docs.fedoraproject.org/en-US/epel/),\nthen you can install ugrep.\n\n    $ dnf install ugrep\n\nCheck \u003chttps://packages.fedoraproject.org/pkgs/ugrep/ugrep/\u003e for version info.\n\n### Debian\n\n    $ apt-get install ugrep\n\nCheck \u003chttps://packages.debian.org/ugrep\u003e for version info.  To build and try\n`ugrep` locally, see \"All platforms\" build steps further below.\n\n### Fedora\n\n    $ dnf install ugrep\n\nCheck \u003chttps://packages.fedoraproject.org/pkgs/ugrep/ugrep/\u003e for version info.\n\n### FreeBSD\n\n    $ pkg install ugrep\n\nCheck \u003chttps://www.freshports.org/textproc/ugrep\u003e for version info.\n\n### Haiku\n\n    $ pkgman install cmd:ugrep\n\nCheck \u003chttps://github.com/haikuports/haikuports/tree/master/app-text/ugrep\u003e for\nversion info.  To build and try `ugrep` locally, see \"All platforms\" build\nsteps further below.\n\n### NetBSD\n\nYou can use the standard NetBSD package installer (pkgsrc):\n\u003chttp://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc/textproc/ugrep/README.html\u003e\n\n### OpenBSD\n\n    $ pkg_add ugrep\n\nCheck \u003chttps://openports.pl/path/sysutils/ugrep\u003e for version info.\n\n### OpenSUSE\n\n    $ zypper install ugrep\n\nCheck \u003chttps://build.opensuse.org/package/show/utilities/ugrep\u003e for version info.\n\n### RHEL\n\nFirst enable the [EPEL repository](https://docs.fedoraproject.org/en-US/epel/),\nthen you can install ugrep.\n\n    $ dnf install ugrep\n\nCheck \u003chttps://packages.fedoraproject.org/pkgs/ugrep/ugrep/\u003e for version info.\n\n### Other platforms: step 1 download\n\nClone `ugrep` with\n\n    $ git clone https://github.com/Genivia/ugrep\n\nOr visit \u003chttps://github.com/Genivia/ugrep/releases\u003e to download a specific release.\n\n### Other platforms: step 2 consider optional dependencies\n\nYou can always add these later, when you need these features:\n\n- Option `-P` (Perl regular expressions) requires either the PCRE2 library\n  (recommended) or the Boost.Regex library (optional fallback).  If PCRE2 is\n  not installed, install PCRE2 with e.g. `sudo apt-get install -y libpcre2-dev`\n  or [download PCRE2](https://www.pcre.org) and follow the installation\n  instructions.  Alternatively,\n  [download Boost.Regex](https://www.boost.org/users/download) and run\n  `./bootstrap.sh` and `sudo ./b2 --with-regex install`.  See\n  [Boost: getting started](https://www.boost.org/doc/libs/1_72_0/more/getting_started/unix-variants.html).\n\n- Option `-z` (compressed files and archives search) requires the\n  [zlib](https://www.zlib.net) library installed.  It is installed on most\n  systems.  If not, install it, e.g. with `sudo apt-get install -y libz-dev`.\n  To search `.bz` and `.bz2` files, install the\n  [bzip2](https://www.sourceware.org/bzip2) library (recommended), e.g. with\n  `sudo apt-get install -y libbz2-dev`.  To search `.lzma` and `.xz` files,\n  install the [lzma](https://tukaani.org/xz) library (recommended), e.g. with\n  `sudo apt-get install -y liblzma-dev`.  To search `.lz4` files, install the\n  [lz4](https://github.com/lz4/lz4) library (optional, not required), e.g.\n  with `sudo apt-get install -y liblz4-dev`.  To search `.zst` files, install\n  the [zstd](http://facebook.github.io/zstd) library (optional, not required),\n  e.g. with `sudo apt-get install -y libzstd-dev`.  To search `.br` files,\n  install the [brotli](https://github.com/google/brotli) library (optional, not\n  required), e.g. with `sudo apt-get install -y libbrotli-dev`.  To search\n  `.bz3` files, install the [bzip3](https://github.com/kspalaiologos/bzip3)\n  library (optional, not required), e.g. with `sudo apt-get install -y bzip3`.\n\n\u003e[!TIP]\n\u003eEven if your system has command line utilities, such as `bzip2`, that\n\u003edoes not necessarily mean that the development libraries such as `libbz2` are\n\u003einstalled.  The *development libraries* should be installed.\n\u003e\n\u003eSome Linux systems may not be configured to load dynamic libraries from\n\u003e`/usr/local/lib`, causing a library load error when running `ugrep`.  To\n\u003ecorrect this, add `export LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:/usr/local/lib\"`\n\u003eto your `~/.bashrc` file.  Or run `sudo ldconfig /usr/local/lib`.\n\n### Other platforms: step 3 build\n\nExecute the `./build.sh` script to build `ugrep`:\n\n    $ cd ugrep\n    $ ./build.sh\n\nThis builds the `ugrep` executable in the `ugrep/src` directory with\n`./configure` and `make -j`, verified with `make test`.  When all tests pass,\nthe `ugrep` executable is copied to `ugrep/bin/ugrep` and the symlink\n`ugrep/bin/ug -\u003e ugrep/bin/ugrep` is added for the `ug` command.\n\nNote that `ug` is the same as `ugrep` but also loads the configuration file\n.ugrep when present in the working directory or home directory.  This means\nthat you can define your default options for `ug` in .ugrep.\n\nAlternative paths to installed or local libraries may be specified with\n`./build.sh`.  To get help on the available build options:\n\n    $ ./build.sh --help\n\nYou can build static executables by specifying:\n\n    $ ./build.sh --enable-static\n\nThis may fail if libraries don't link statically, such as brotli.  In that case\ntry `./build.sh --enable-static --without-brotli`.\n\nYou can build `ugrep` with customized defaults enabled, such as a pager:\n\n    $ ./build.sh --enable-pager\n\nOptions to select defaults for builds include:\n\n- `--help` display build options\n- `--enable-static` build static executables, if possible\n- `--enable-hidden` always search hidden files and directories\n- `--enable-pager` always use a pager to display output on terminals\n- `--enable-pretty` colorize output to terminals and add filename headings\n- `--disable-auto-color` disable automatic colors, requires ugrep option `--color=auto` to show colors\n- `--disable-mmap` disable memory mapped files\n- `--disable-sse2` disable SSE2 and AVX optimizations\n- `--disable-avx2` disable AVX2 and AVX512BW optimizations, but compile with SSE2 when supported\n- `--disable-neon` disable ARM NEON/AArch64 optimizations\n- `--with-grep-path` the default `-f` path if `GREP_PATH` is not defined\n- `--with-grep-colors` the default colors if `GREP_COLORS` is not defined\n\nAfter the build completes, copy `ugrep/bin/ugrep` and `ugrep/bin/ug` to a\nconvenient location, for example in your `~/bin` directory. Or, if you may want\nto install the `ugrep` and `ug` commands and man pages:\n\n    $ sudo make install\n\nThis also installs the pattern files with predefined patterns for option `-f`\nat `/usr/local/share/ugrep/patterns/`.  Option `-f` first checks the working\ndirectory for the presence of pattern files, if not found checks environment\nvariable `GREP_PATH` to load the pattern files, and if not found reads the\ninstalled predefined pattern files.\n\n### Troubleshooting\n\n#### Git and timestamps\n\nUnfortunately, git clones do not preserve timestamps which means that you may\nrun into \"WARNING: 'aclocal-1.15' is missing on your system.\" or that\nautoheader was not found when running `make`.\n\nTo work around this problem, run:\n\n    $ autoreconf -fi\n    $ ./build.sh\n\n#### Compiler warnings\n\nGCC 8 and greater may produce warnings of the sort *\"note: parameter passing\nfor argument ... changed in GCC 7.1\"*.  These warnings should be ignored.\n\n### Dockerfile for developers\n\nA Dockerfile is included to build `ugrep` in a Ubuntu container.\n\nDevelopers may want to use sanitizers to verify the **ugrep** code when making\nsignificant changes, for example to detect data races with the\n[ThreadSanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html):\n\n    $ ./build.sh CXXFLAGS='-fsanitize=thread -O1 -g'\n\nWe checked `ugrep` with the clang AddressSanitizer, MemorySanitizer,\nThreadSanitizer, and UndefinedBehaviorSanitizer.  These options incur\nsignificant runtime overhead and should not be used for the final build.\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"speed\"/\u003e\n\nPerformance comparisons\n-----------------------\n\nPlease note that the **ugrep** and **ug** commands search binary files by\ndefault and do not ignore .gitignore specified files, which will not make\nrecursive search performance comparisons meaningful unless options `-I` and\n`--ignore-files` are used.  To make these options the default for **ug**,\nsimply add `ignore-binary` and `ignore-files` to your .ugrep configuration\nfile.\n\nFor an up-to-date performance comparison of the latest ugrep, please see the\n[ugrep performance benchmarks](https://github.com/Genivia/ugrep-benchmarks).\nUgrep is faster than GNU grep, Silver Searcher, ack, sift.  Ugrep's speed beats\nripgrep in most benchmarks.\n\n\u003ca name=\"vim\"/\u003e\n\nUsing ugrep within Vim\n----------------------\n\nFirst, let's define the `:grep` command in Vim to search files recursively.  To\ndo so, add the following lines to your `.vimrc` located in the root directory:\n\n    if executable('ugrep')\n        set grepprg=ugrep\\ -RInk\\ -j\\ -u\\ --tabs=1\\ --ignore-files\n        set grepformat=%f:%l:%c:%m,%f+%l+%c+%m,%-G%f\\\\\\|%l\\\\\\|%c\\\\\\|%m\n    endif\n\nThis specifies `-j` [case insensitive searches](#case) with the Vim `:grep`\ncommand.  For case sensitive searches, remove `\\ -j` from `grepprg`.  Multiple\nmatches on the same line are listed in the quickfix window separately.  If this\nis not desired, remove `\\ -u` from `grepprg`.  With this change, only the first\nmatch on a line is shown.  Option `--ignore-files` skips files specified in\n`.gitignore` files, when present.  To limit the depth of recursive searches to\nthe current directory only, append `\\ -1` to `grepprg`.\n\nYou can now invoke the Vim `:grep` command in Vim to search files on a\nspecified `PATH` for `PATTERN` matches:\n\n    :grep PATTERN [PATH]\n\nIf you omit `PATH`, then the working directory is searched.  Use `%` as `PATH`\nto search only the currently opened file in Vim:\n\n    :grep PATTERN %\n\nThe `:grep` command shows the results in a\n[quickfix](http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:grep) window\nthat allows you to quickly jump to the matches found.\n\nTo open a quickfix window with the latest list of matches:\n\n    :copen\n\nDouble-click on a line in this window (or select a line and press ENTER) to\njump to the file and location in the file of the match.  Enter commands `:cn`\nand `:cp` to jump to the next or previous match, respectively.  To update the\nsearch results in the quickfix window, just grep them.  For example, to\nrecursively search C++ source code marked `FIXME` in the working directory:\n\n    :grep -tc++ FIXME\n\nTo close the quickfix window:\n\n    :cclose\n\nYou can use **ugrep** options with the `:grep` command, for example to\nselect single- and multi-line comments in the current file:\n\n    :grep -f c++/comments %\n\nOnly the first line of a multi-line comment is shown in quickfix, to save\nspace.  To show all lines of a multi-line match, remove `%-G` from\n`grepformat`.\n\nA popular Vim tool is [ctrlp.vim](http://kien.github.io/ctrlp.vim), which is\ninstalled with:\n\n    $ cd ~/.vim\n    $ git clone https://github.com/kien/ctrlp.vim.git bundle/ctrlp.vim\n\nCtrlP uses **ugrep** by adding the following lines to your `.vimrc`:\n\n    if executable('ugrep')\n        set runtimepath^=~/.vim/bundle/ctrlp.vim\n        let g:ctrlp_match_window='bottom,order:ttb'\n        let g:ctrlp_user_command='ugrep \"\" %s -Rl -I --ignore-files -3'\n    endif\n\nwhere `-I` skips binary files, option `--ignore-files` skips files specified in\n`.gitignore` files, when present, and option `-3` restricts searching\ndirectories to three levels (the working directory and up to two levels below).\n\nStart Vim then enter the command:\n\n    :helptags ~/.vim/bundle/ctrlp.vim/doc\n\nTo view the CtrlP documentation in Vim, enter the command:\n\n    :help ctrlp.txt\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"emacs\"/\u003e\n\nUsing ugrep within Emacs\n------------------------\n\nThanks to [Manuel Uberti](https://github.com/emacs-mirror/emacs/commits?author=manuel-uberti),\nyou can now use **ugrep** in Emacs.  To use **ugrep** instead of GNU grep\nwithin Emacs, add the following line to your `.emacs.d/init.el` file:\n\n    (setq-default xref-search-program ‘ugrep)\n\nThis means that Emacs commands such as `project-find-regexp` that rely on\n[Xref](https://www.gnu.org/software/emacs/manual/html_node/emacs/Xref.html) can\nnow leverage the power of **ugrep**.\n\nFurthermore, it is possible to use `grep` in the [Emacs grep\ncommands](https://www.gnu.org/software/emacs/manual/html_node/emacs/Grep-Searching.html).\nFor instance, you can run `lgrep` with `ugrep` by customizing `grep-template`\nto something like the following:\n\n    (setq-default grep-template \"ugrep --color=always -0Iinr -e \u003cR\u003e\")\n\nIf you do not have Emacs version 29 (or greater) you can download and build\nEmacs from the [Emacs master branch](https://github.com/emacs-mirror/emacs),\nor enable Xref integration with **ugrep** manually:\n\n    (with-eval-after-load 'xref\n     (push '(ugrep . \"xargs -0 ugrep \u003cC\u003e --null -ns -e \u003cR\u003e\")\n           xref-search-program-alist)\n     (setq-default xref-search-program 'ugrep))\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"grep\"/\u003e\n\nUsing ugrep to replace GNU/BSD grep\n-----------------------------------\n\n**ugrep** supports all standard GNU/BSD grep command-line options and improves\nmany of them too.  See [notable improvements over grep](#improvements).\n\nIn fact, executing `ugrep` with options `-U`, `-Y`, `-.` and `--sort` makes it\nbehave like `egrep`, permitting empty patterns to match and search hidden files\ninstead of ignoring them.  See [grep equivalence](#equivalence).\n\n- You can create [convenient grep aliases](#aliases) with or without options\n  `-Y`, `-.` and `--sort` or include other options as desired.  If you really\n  must stick exactly to GNU/BSD grep ASCII/LATIN1 patterns, use options `-U`\n  and `--grep` to disable Unicode pattern matching and to reassign options `-z`\n  and `-Z` to `--null-data` and `--null`, respectively.\n\n- You can also create `grep`, `egrep` and `fgrep` executables by symlinking or\n  copying `ugrep` to those names.  When the `ugrep` (or `ugrep.exe`) executable\n  is copied as `grep` (`grep.exe`), `egrep` (`egrep.exe`), `fgrep`\n  (`fgrep.exe`), then options `-Y` and `-.` are automatically enabled together\n  with either `-G` for `grep`, `-E` for `egrep` and `-F` for `fgrep`.  In\n  addition, when copied as `zgrep`, `zegrep` and `zfgrep`, option\n  `--decompress` is enabled.  For example, when `ugrep` is copied as `zegrep`,\n  options `--decompress`, `-E`, `-Y`, `-.` and `--sort` are enabled.\n\n- Likewise, symlinks and hard links can be used to create `grep`, `egrep` and\n  `fgrep` replacements in the usual installation directories.  For example:\n\n      sudo ln -s `which ugrep` /opt/local/bin/grep\n      sudo ln -s `which ugrep` /opt/local/bin/egrep\n      sudo ln -s `which ugrep` /opt/local/bin/fgrep\n      sudo ln -s `which ugrep` /opt/local/bin/zgrep\n      sudo ln -s `which ugrep` /opt/local/bin/zegrep\n      sudo ln -s `which ugrep` /opt/local/bin/zfgrep\n\n  The `/opt/local/bin` here is an example and may or may not be in your `$path`\n  and may or may not be found, so please adjust as necessary.  **Caution:**\n  *bash does not obey the linked name when executing the program, reverting to\n  the name `ugrep` instead, which negates all internal compatibility settings.\n  To avoid this, copy the executables instead of linking!*\n\nWhen linking or copying `ugrep` to `grep`, `egrep`, `fgrep`, `zgrep`, `zegrep`,\n`zfgrep`, options `-z` and `-Z` are reassigned for compatibility to GNU/BSD\ngrep options `--null-data` and `--null`, respectively.\n\n\u003ca name=\"equivalence\"/\u003e\n\n### Equivalence to GNU/BSD grep\n\nWhen the `ugrep` executable file is symlinked or copied to `grep`, `egrep`,\n`fgrep`, `zgrep`, `zegrep` and `zfgrep` executables, then those executables\nwill behave as GNU grep equivalents.  This behavior is implicit and automatic,\nessentially using the following translations:\n\n    grep   = ugrep -G -Y -. --sort\n    egrep  = ugrep -E -Y -. --sort\n    fgrep  = ugrep -F -Y -. --sort\n\n    zgrep  = ugrep -z -G -Y -. --sort\n    zegrep = ugrep -z -E -Y -. --sort\n    zfgrep = ugrep -z -F -Y -. --sort\n\nplease note that:\n\n- `-Y` enables empty matches, so for example the pattern `a*` matches every\n  line instead of a sequence of `a`'s.  By default in ugrep, the pattern `a*`\n  matches a sequence of `a`'s.  Moreover, in ugrep the pattern `a*b*c*` matches\n  what it is supposed to match by default.  See [improvements](#improvements).\n- `-.` searches hidden files (dotfiles).  By default, hidden files are ignored,\n  like most Unix utilities.\n- `--sort` specifies output sorted by pathname, showing sorted matching files\n  first followed by sorted recursive matches in subdirectories.  Otherwise,\n  matching files are reported in no particular order to improve performance;\n- options `-z` and `-Z` are reassigned to `--null-data` and `--null` and no\n  longer enable `--decompress` and `--fuzzy` searching modes.\n\nThere is one minor difference with GNU/BSD grep:\n\n- GNU/BSD grep defaults to `-Dread` and `-dread` which are not recommended, see\n  [improvements](#improvements) for an explanation.\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"aliases\"/\u003e\n\n### Short and quick command aliases\n\nCommonly-used aliases to add to `.bashrc` to increase productivity:\n\n    alias uq     = 'ug -Q'                # interactive TUI search (uses .ugrep config)\n    alias uz     = 'ug -z'                # compressed files and archives search (uses .ugrep config)\n    alias ux     = 'ug -U --hexdump'      # binary pattern search (uses .ugrep config)\n\n    alias ugit   = 'ug -R --ignore-files' # works like git-grep \u0026 define your preferences in .ugrep config\n\n    alias grep   = 'ug -G'                # search with basic regular expressions (BRE) like grep\n    alias egrep  = 'ug -E'                # search with extended regular expressions (ERE) like egrep\n    alias fgrep  = 'ug -F'                # find string(s) like fgrep\n    alias zgrep  = 'ug -zG'               # search compressed files and archives with BRE\n    alias zegrep = 'ug -zE'               # search compressed files and archives with ERE\n    alias zfgrep = 'ug -zF'               # find string(s) in compressed files and/or archives\n\n    alias xdump  = 'ugrep -X \"\"'                 # hexdump files without searching (don't use .ugrep config)\n    alias zmore  = 'ugrep+ -z -I -+ --pager \"\"'  # view compressed, archived and regular files (don't use .ugrep config)\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"improvements\"/\u003e\n\n### Notable improvements over grep\n\n- **ugrep** starts an interactive query TUI with option `-Q`.\n- **ugrep** matches patterns across multiple lines when patterns match `\\n`.\n- **ugrep** matches full Unicode by default (disabled with option `-U`).\n- **ugrep** supports Boolean patterns with AND, OR and NOT (option `--bool`).\n- **ugrep** supports gitignore with option `--ignore-files`.\n- **ugrep** supports fuzzy (approximate) matching with option `-Z`.\n- **ugrep** supports user-defined global and local configuration files.\n- **ugrep** searches compressed files and archives with option `-z`.\n- **ugrep** searches cpio, jar, pax, tar, zip and 7z archives with option `-z`.\n- **ugrep** searches cpio, jar, pax, tar, zip and 7z archives recursively\n  stored within archives with `-z` and `--zmax=NUM` for up to `NUM` levels deep.\n- **ugrep** searches pdf, doc, docx, xls, xlsx, epub, and more with `--filter`\n  using third-party format conversion utilities as plugins.\n- **ugrep** searches a directory when the FILE argument is a directory, like\n  most Unix/Linux utilities; use option `-r` to search directories recursively.\n- **ugrep** does not match hidden files by default like most Unix/Linux\n  utilities (hidden dotfile file matching is enabled with `-.`).\n- **ugrep** regular expression patterns are more expressive than GNU grep and\n  BSD grep POSIX ERE and support Unicode pattern matching.  Extended regular\n  expression (ERE) syntax is the default (i.e. option `-E` as egrep, whereas\n  `-G` enables BRE).\n- **ugrep** spawns threads to search files concurrently to improve search\n  speed (disabled with option `-J1`).\n- **ugrep** produces hexdumps with `-W` (output binary matches in hex with text\n  matches output as usual) and `-X` (output all matches in hex).\n- **ugrep** can output matches in JSON, XML, CSV and user-defined formats (with\n  option `--format`).\n- **ugrep** option `-f` uses `GREP_PATH` environment variable or the predefined\n  patterns installed in `/usr/local/share/ugrep/patterns`.  If `-f` is\n  specified and also one or more `-e` patterns are specified, then options\n  `-F`, `-x`, and `-w` do not apply to `-f` patterns.  This is to avoid\n  confusion when `-f` is used with predefined patterns that may no longer work\n  properly with these options.\n- **ugrep** options `-O`, `-M`, and `-t` specify file extensions, file\n  signature magic byte patterns, and predefined file types, respectively.  This\n  allows searching for certain types of files in directory trees, for example\n  with recursive search options `-R` and `-r`.  Options `-O`, `-M`, and `-t`\n  also applies to archived files in cpio, jar, pax, tar, zip and 7z files.\n- **ugrep** option `-k`, `--column-number` to display the column number, taking\n  tab spacing into account by expanding tabs, as specified by option `--tabs`.\n- **ugrep** option `-P` (Perl regular expressions) supports backreferences\n  (with `--format`) and lookbehinds, which uses the PCRE2 or Boost.Regex\n  library for fast Perl regex matching with a PCRE-like syntax.\n- **ugrep** option `-b` with option `-o` or with option `-u`, ugrep displays\n  the exact byte offset of the pattern match instead of the byte offset of the\n  start of the matched line reported by GNU/BSD grep.\n- **ugrep** option `-u`, `--ungroup` to not group multiple matches per line.\n  This option displays a matched input line again for each additional pattern\n  match on the line.  This option is particularly useful with option `-c` to\n  report the total number of pattern matches per file instead of the number of\n  lines matched per file.\n- **ugrep** option `-Y` enables matching empty patterns.  Grepping with\n  empty-matching patterns is weird and gives different results with GNU grep\n  versus BSD grep.  Empty matches are not output by **ugrep** by default, which\n  avoids making mistakes that may produce \"random\" results.  For example, with\n  GNU/BSD grep, pattern `a*` matches every line in the input, and actually\n  matches `xyz` three times (the empty transitions before and between the `x`,\n  `y`, and `z`).  Allowing empty matches requires **ugrep** option `-Y`.\n  Patterns that start with `^` or end with `$`, such as `^\\h*$`, match empty.\n  These patterns automatically enable option `-Y`.\n- **ugrep** option `-D, --devices=ACTION` is `skip` by default, instead of\n  `read`.  This prevents unexpectedly hanging on named pipes in directories\n  that are recursively searched, as may happen with GNU/BSD grep that `read`\n  devices by default.\n- **ugrep** option `-d, --directories=ACTION` is `skip` by default, instead of\n  `read`.  By default, directories specified on the command line are searched,\n  but not recursively deeper into subdirectories.\n- **ugrep** offers *negative patterns* `-N PATTERN`, which are patterns of the\n  form `(?^X)` that skip all `X` input, thus removing `X` from the search.\n  For example, negative patterns can be used to skip strings and comments when\n  searching for identifiers in source code and find matches that aren't in\n  strings and comments.  Predefined `zap` patterns use negative patterns, for\n  example, use `-f cpp/zap_comments` to ignore pattern matches in C++ comments.\n- **ugrep** ignores the `GREP_OPTIONS` environment variable, because the\n  behavior of **ugrep** must be portable and predictable on every system.  Also\n  GNU grep abandoned `GREP_OPTIONS` for this reason.  Please use the `ug`\n  command that loads the .ugrep configuration file located in the working\n  directory or in the home directory when present, or use shell aliases to\n  create new commands with specific search options.\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"tutorial\"/\u003e\n\nTutorial\n--------\n\n\u003ca name=\"examples\"/\u003e\n\n### Examples\n\nTo perform a search using a configuration file `.ugrep` placed in the working\ndirectory or home directory (note that `ug` is the same as `ugrep --config`):\n\n    ug PATTERN FILE...\n\nTo save a `.ugrep` configuration file to the working directory, then edit this\nfile in your home directory to customize your preferences for `ug` defaults:\n\n    ug --save-config\n\nTo search the working directory and recursively deeper for `main` (note that\n`-r` recurse symlinks is enabled by default if no file arguments are\nspecified):\n\n    ug main\n\nSame, but only search C++ source code files recursively, ignoring all other\nfiles:\n\n    ug -tc++ main\n\nSame, using the interactive query TUI, starting with the initial search pattern\n`main` (note that `-Q` with an initial pattern requires option `-e` because\npatterns are normally specified interactively and all command line arguments\nare considered files/directories):\n\n    ug -Q -tc++ -e main\n\nTo search for `#define` (and `# define` etc) using a regex pattern in C++ files\n(note that patterns should be quoted to prevent shell globbing of `*` and `?`):\n\n    ug -tc++ '#[\\t ]*define'\n\nTo search for `main` as a word (`-w`) recursively without following symlinks\n(`-r`) in directory `myproject`, showing the matching line (`-n`) and column\n(`-k`) numbers next to the lines matched:\n\n    ug -r -nkw main myproject\n\nSame, but only search `myproject` without recursing deeper (note that directory\narguments are searched at one level by default):\n\n    ug -nkw main myproject\n\nSame, but search `myproject` and one subdirectory level deeper (two levels)\nwith `-2`:\n\n    ug -2 -nkw main myproject\n\nSame, but only search C++ files in `myproject` and its subdirectories with\n`-tc++`:\n\n    ug -tc++ -2 -nkw main myproject\n\nSame, but also search inside archives (e.g. zip and tar files) and compressed\nfiles with `-z`:\n\n    ug -z -tc++ -2 -nkw main myproject\n\nSearch recursively the working directory for `main` while ignoring gitignored\nfiles (e.g.  assuming `.gitignore` is in the working directory or below):\n\n    ug --ignore-files -tc++ -nkw main\n\nTo list all files in the working directory and deeper that are not ignored by\n`.gitignore` file(s):\n\n    ug --ignore-files -l ''\n\nTo display the list of file name extensions and \"magic bytes\" (shebangs)\nthat are searched corresponding to `-t` arguments:\n\n    ug -tlist\n\nTo list all shell files recursively, based on extensions and shebangs with `-l`\n(note that `''` matches any non-empty file):\n\n    ug -l -tShell ''\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"advanced\"/\u003e\n\n### Advanced examples\n\nTo search for `main` in source code while ignoring strings and comment blocks\nyou can use *negative patterns* with option `-N` to skip unwanted matches in\nC/C++ quoted strings and comment blocks:\n\n    ug -r -nkw -e 'main' -N '\"(\\\\.|\\\\\\r?\\n|[^\\\\\\n\"])*\"|//.*|/\\*(.*\\n)*?.*\\*+\\/' myproject\n\nThis is a lot of work to type in correctly!  If you are like me, I don't want\nto spend time fiddling with regex patterns when I am working on something more\nimportant.  There is an easier way by using **ugrep**'s predefined patterns\n(`-f`) that are installed with the `ugrep` tool:\n\n    ug -r -nkw 'main' -f c/zap_strings -f c/zap_comments myproject\n\nThis query also searches through other files than C/C++ source code, like\nREADMEs, Makefiles, and so on.  We're also skipping symlinks with `-r`.  So\nlet's refine this query by selecting C/C++ files only using option `-tc,c++`\nand include symlinks to files and directories with `-R`:\n\n    ug -R -tc,c++ -nkw 'main' -f c/zap_strings -f c/zap_comments myproject\n\nWhat if you only want to look for the identifier `main` but not as a function\n`main(`?  In this case, use a negative pattern for this to skip unwanted\n`main\\h*(` pattern matches:\n\n    ug -R -tc,c++ -nkw -e 'main' -N 'main\\h*\\(' -f c/zap_strings -f c/zap_comments myproject\n\nThis uses the `-e` and `-N` options to explicitly specify a pattern and a\nnegative pattern, respectively, which is essentially forming the pattern\n`main|(?^main\\h*\\()`, where `\\h` matches space and tab.  In general, negative\npatterns are useful to filter out pattern matches that we are not interested\nin.\n\nAs another example, let's say we may want to search for the word `FIXME` in\nC/C++ comment blocks.  To do so we can first select the comment blocks with\n**ugrep**'s predefined `c/comments` pattern AND THEN select lines with `FIXME`\nusing a pipe:\n\n    ug -R -tc,c++ -nk -f c/comments myproject | ug -w 'FIXME'\n\nFiltering results with pipes is generally easier than using AND-OR logic that\nsome search tools use.  This approach follows the Unix spirit to keep utilities\nsimple and use them in combination for more complex tasks.\n\nLet's produce a sorted list of all identifiers found in Java source code while\nskipping strings and comments:\n\n    ug -R -tjava -f java/names myproject | sort -u\n\nThis matches Java Unicode identifiers using the regex\n`\\p{JavaIdentifierStart}\\p{JavaIdentifierPart}*` defined in\n`patterns/java/names`.\n\nWith traditional grep and grep-like tools it takes great effort to recursively\nsearch for the C/C++ source file that defines function `qsort`, requiring\nsomething like this:\n\n    ug -R --include='*.c' --include='*.cpp' '^([ \\t]*[[:word:]:*\u0026]+)+[ \\t]+qsort[ \\t]*\\([^;\\n]+$' myproject\n\nFortunately, with **ugrep** we can simply select all function definitions in\nfiles with extension `.c` or `.cpp` by using option `-Oc,cpp` and by using a\npredefined pattern `functions` that is installed with the tool to produce\nall function definitions.  Then we select the one we want:\n\n    ug -R -Oc,cpp -nk -f c/functions | ug 'qsort'\n\nNote that we could have used `-tc,c++` to select C/C++ files, but this also\nincludes header files when we want to only search `.c` and `.cpp` files.\n\nWe can also skip files and directories from being searched that are defined in\n`.gitignore`.  To do so we use `--ignore-files` to exclude any files and\ndirectories from recursive searches that match the globs in `.gitignore`, when\none or more `.gitignore` files are found:\n\n    ug -R -tc++ --ignore-files -f c++/defines\n\nThis searches C++ files (`-tc++`) in the working directory for `#define`\nlines (`-f c++/defines`), while skipping files and directories declared in\n`.gitignore`.  If you find this too long to type then define an alias to search\nGitHub directories:\n\n    alias ugit='ugrep -R --ignore-files'\n    ugit -tc++ -f c++/defines\n\nTo highlight matches when pushed through a chain of pipes we should use\n`--color=always`:\n\n    ugit --color=always -tc++ -f c++/defines | ugrep -w 'FOO.*'\n\nThis returns a color-highlighted list of all `#define FOO...` macros in C/C++\nsource code files, skipping files defined in `.gitignore`.\n\nNote that the complement of `--exclude` is not `--include`, because exclusions\nalways take precedence over inclusions, so we cannot reliably list the files\nthat are ignored with `--include-from='.gitignore'`.  Only files explicitly\nspecified with `--include` and directories explicitly specified with\n`--include-dir` are visited.  The `--include-from` from lists globs that are\nconsidered both files and directories to add to `--include` and\n`--include-dir`, respectively.  This means that when directory names and\ndirectory paths are not explicitly listed in this file then it will not be\nvisited using `--include-from`.\n\nBecause ugrep checks if the input is valid UTF-encoded Unicode (unless `-U` is\nused), it is possible to use it as a filter to ignore non-UTF output produced\nby a program:\n\n    program | ugrep -I ''\n\nIf the program produces valid output then the output is passed through,\notherwise the output is filtered out option `-I`.  If the output is initially\nvalid for a very large portion but is followed by invalid output, then ugrep\nmay initially show the output up to but excluding the invalid output after\nwhich further output is blocked.\n\nTo filter lines that are valid ASCII or UTF-encoded, while removing lines that\nare not:\n\n    program | ugrep '[\\p{Unicode}--[\\n]]+'\n\nNote that `\\p{Unicode}` matches `\\n` but we don't want to matche the whole\nfile!  Just lines with `[\\p{Unicode}--[\\n]]+`.\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"help\"/\u003e\n\n### Displaying helpful info\n\nThe ugrep man page:\n\n    man ugrep\n\nTo show a help page:\n\n    ug --help\n\nTo show options that mention `WHAT`:\n\n    ug --help WHAT\n\nTo show a list of `-t TYPES` option values:\n\n    ug -tlist\n\nIn the interactive query TUI, press F1 or CTRL-Z for help and options:\n\n    ug -Q\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"config\"/\u003e\n\n### Configuration files\n\n    --config[=FILE], ---[FILE]\n            Use configuration FILE.  The default FILE is `.ugrep'.  The working\n            directory is checked first for FILE, then the home directory.  The\n            options specified in the configuration FILE are parsed first,\n            followed by the remaining options specified on the command line.\n            The ug command automatically loads a `.ugrep' configuration file,\n            unless --config=FILE or --no-config is specified.\n    --no-config\n            Do not load the default .ugrep configuration file.\n    --save-config[=FILE] [OPTIONS]\n            Save configuration FILE to include OPTIONS.  Update FILE when\n            first loaded with --config=FILE.  The default FILE is `.ugrep',\n            which is automatically loaded by the ug command.  When FILE is a\n            `-', writes the configuration to standard output.  Only part of the\n            OPTIONS are saved that do not cause searches to fail when combined\n            with other options.  Additional options may be specified by editing\n            the saved configuration file.  A configuration file may be modified\n            manually to specify one or more config[=FILE] to indirectly load\n            the specified FILEs, but recursive config loading is not allowed.\n\n#### The ug command versus the ugrep command\n\nThe `ug` command is intended for context-dependent interactive searching and is\nequivalent to the `ugrep --config` command to load the configuration file\n`.ugrep` when present in the working directory or, when not found, in the home\ndirectory:\n\n    ug PATTERN ...\n    ugrep --config PATTERN ...\n\nThe `ug` command also sorts files by name per directory searched.  A\nconfiguration file contains `NAME=VALUE` pairs per line, where `NAME` is the\nname of a long option (without `--`) and `=VALUE` is an argument, which is\noptional and may be omitted depending on the option.  Empty lines and lines\nstarting with a `#` are ignored:\n\n    # Color scheme\n    colors=cx=hb:ms=hiy:mc=hic:fn=hi+y+K:ln=hg:cn=hg:bn=hg:se=\n    # Disable searching hidden files and directories\n    no-hidden\n    # ignore files specified in .ignore and .gitignore in recursive searches\n    ignore-files=.ignore\n    ignore-files=.gitignore\n\nCommand line options are parsed in the following order: first the (default or\nnamed) configuration file is loaded, then the remaining options and\narguments on the command line are parsed.\n\nOption `--stats` displays the configuration file used after searching.\n\n#### Named configuration files\n\nNamed configuration files are intended to streamline custom search tasks, by\nreducing the number of command line options to just one `---FILE` to use the\ncollection of options specified in `FILE`.  The `--config=FILE` option and its\nabbreviated form `---FILE` load the specified configuration file located in the\nworking directory or, when not found, located in the home directory:\n\n    ug ---FILE PATTERN ...\n    ugrep ---FILE PATTERN ...\n\nAn error is produced when `FILE` is not found or cannot be read.\n\nNamed configuration files can be used to define a collection of options that\nare specific to the requirements of a task in the development workflow of a\nproject.  For example to report unresolved issues by checking the source code\nand documentation for comments with FIXME and TODO items.  Such named\nconfiguration file can be localized to a project by placing it in the project\ndirectory, or it can be made global by placing it in the home directory.  For\nvisual feedback, a color scheme specific to this task can be specified with\noption `colors` in the configuration `FILE` to help identify the output\nproduced by a named configuration as opposed to the default configuration.\n\n#### Saving a configuration file\n\nThe `--save-config` option saves a `.ugrep` configuration file to the working\ndirectory using the current configuration loaded with `--config`.  This saves\nthe current configuration combined with additional options when specified also.\nOnly those options that cannot conflict with other options and options that\ncannot negatively impact search results will be saved.\n\nThe `--save-config=FILE` option saves the configuration to the specified `FILE`.\nThe configuration is written to standard output when `FILE` is a `-`.\n\nAlternatively, a configuration file may be manually created or modified.  A\nconfiguration file may include one or more `config[=FILE]` to indirectly load\nthe specfified `FILE`, but recursive config loading is prohibited.  The\nsimplest way to manuall create a configuration file is to specify `config` at\nthe top of the file, followed by the long options to override the defaults.\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"query\"/\u003e\n\n### Interactive search with -Q\n\n    -Q[=DELAY], --query[=DELAY]\n            Query mode: start a TUI to perform interactive searches.  This mode\n            requires an ANSI capable terminal.  An optional DELAY argument may\n            be specified to reduce or increase the response time to execute\n            searches after the last key press, in increments of 100ms, where\n            the default is 3 (300ms delay).  No whitespace may be given between\n            -Q and its argument DELAY.  Initial patterns may be specified with\n            -e PATTERN, i.e. a PATTERN argument requires option -e.  Press F1\n            or CTRL-Z to view the help screen.  Press F2 or CTRL-Y to invoke a\n            command to view or edit the file shown at the top of the screen.\n            The command can be specified with option --view, or defaults to\n            environment variable PAGER when defined, or EDITOR.  Press Tab and\n            Shift-Tab to navigate directories and to select a file to search.\n            Press Enter to select lines to output.  Press ALT-l for option -l\n            to list files, ALT-n for -n, etc.  Non-option commands include\n            ALT-] to increase context.  See also options --no-confirm, --delay,\n            --split and --view.\n    --no-confirm\n            Do not confirm actions in -Q query TUI.  The default is confirm.\n    --delay=DELAY\n            Set the default -Q key response delay.  Default is 3 for 300ms.\n    --split\n            Split the -Q query TUI screen on startup.\n    --view[=COMMAND]\n            Use COMMAND to view/edit a file in -Q query TUI by pressing CTRL-Y.\n\nThis option starts a user interface to enter search patterns interactively:\n- Press F1 or CTRL-Z to view a help screen and to enable or disable options.\n- Press Alt with a key corresponding to a ugrep option letter or digit to\n  enable or disable the ugrep option.  For example, pressing Alt-c enables\n  option `-c` to count matches.  Pressing Alt-c again disables `-c`.  Options\n  can be toggled with the Alt key while searching or when viewing the help\n  screen.  If Alt/Meta keys are not working (e.g. X11 xterm), then press\n  CTRL-O followed by the key corresponding to the option.  Alt keys may work\n  in xterm by adding `xterm*metaSendsEscape: true` to ~/.Xdefaults`.\n- Press Alt-g to enter or edit option `-g` file and directory matching globs, a\n  comma-separated list of gitignore-style glob patterns.  Presssing ESC returns\n  control to the query pattern prompt (the globs are saved).  When a glob is\n  preceded by a `!` or a `^`, skips files whose name matches the glob When a\n  glob contains a `/`, full pathnames are matched.  Otherwise basenames are\n  matched.  When a glob ends with a `/`, directories are matched.\n- The query TUI prompt switches between `Q\u003e` (normal), `F\u003e` (fixed strings),\n  `G\u003e` (basic regex), `P\u003e` (Perl matching), and `Z\u003e` (fuzzy matching).\n  When the `--glob=` prompt is shown, a comma-separated list of gitignore-style\n  glob patterns may be entered.  Presssing ESC returns control to the pattern\n  prompt.\n- Press CTRL-T to split the TUI screen to preview a file in the bottom pane.\n- Press CTRL-Y to view a file with a pager specified with `--view`.\n- Press Enter to switch to selection mode to select lines to output when ugrep\n  exits.  Normally, ugrep in query mode does not output any results unless\n  results are selected.  While in selection mode, select or deselect lines with\n  Enter or Del, or press A to select all results.\n- The file listed or shown at the top of the screen, or beneath the cursor in\n  selection mode, is edited by pressing F2 or CTRL-Y.  A file viewer or editor\n  may be specified with `--view=COMMAND`.  Otherwise, the `PAGER` or `EDITOR`\n  environment variables are used to invoke the command with CTRL-Y.  Filenames\n  must be enabled and visible in the output to use this feature.\n- Press TAB to chdir one level down into the directory of the file listed\n  or viewed at the top of the screen.  If no directory exists, the file itself\n  is selected to search.  Press Shift-TAB to go back up one level.\n- Press CTRL-] to toggle colors on and off.  Normally ugrep in query mode uses\n  colors and other markup to highlight results.  When colors are turned off,\n  selected results are also not colored in the output produced by ugrep when\n  ugrep exits.  When colors are turned on (the default), selected results are\n  colored depending on the `--color` option.\n- The query engine is optimized to limit system load by performing on-demand\n  searches to produce results only for the visible parts shown in the\n  interface.  That is, results are shown on demand, when scrolling down and\n  when exiting when all results are selected.  When the search pattern is\n  modified, the previous search query is cancelled when incomplete.  This\n  effectively limits the load on the system to maintain a high degree of\n  responsiveness of the query engine to user input.  Because the search results\n  are produced on demand, occasionally you may notice a flashing \"Searching...\"\n  message when searching files.\n- To display results faster, specify a low `DELAY` value such as 1.  However,\n  lower values may increase system load as a result of repeatedly initiating\n  and cancelling searches by each key pressed.\n- To avoid long pathnames to obscure the view, `--heading` is enabled by\n  default.  Press Alt-+ to switch headings off.\n\nQuery TUI key mapping:\n\nkey(s)           | function\n---------------- | -------------------------------------------------\n`Alt-key`        | toggle ugrep command-line option corresponding to `key`\n`Alt-/`xxxx`/`   | insert Unicode hex code point U+xxxx\n`Esc` `Ctrl-C`   | go back or exit\n`Ctrl-Q`         | quick exit and output the results selected in selection mode\n`Tab`            | chdir to the directory of the file shown at the top of the screen or select file\n`Shift-Tab`      | chdir one level up or deselect file\n`Enter`          | enter selection mode and toggle selected lines to output on exit\n`Up` `Ctrl-P`    | move up\n`Down` `Ctrl-N`  | move down\n`Left` `Ctrl-B`  | move left\n`Right` `Ctrl-F` | move right\n`PgUp` `Ctrl-G`  | move display up by a page\n`PgDn` `Ctrl-D`  | move display down by a page\n`Alt-Up`         | move display up by 1/2 page (MacOS `Shift-Up`)\n`Alt-Down`       | move display down by 1/2 page (MacOS `Shift-Down`)\n`Alt-Left`       | move display left by 1/2 page (MacOS `Shift-Left`)\n`Alt-Right`      | move display right by 1/2 page (MacOS `Shift-Right`)\n`Home` `Ctrl-A`  | move cursor to the beginning of the line\n`End` `Ctrl-E`   | move cursor to the end of the line\n`Ctrl-K`         | delete after cursor\n`Ctrl-L`         | refresh screen\n`Ctrl-O`+`key`   | toggle ugrep command-line option corresponding to `key`, same as `Alt-key`\n`Ctrl-R` `F4`    | jump to bookmark\n`Ctrl-S`         | jump to the next dir/file/context\n`Ctrl-T` `F5`    | toggle split screen (`--split` starts a split-screen TUI)\n`Ctrl-U`         | delete before cursor\n`Ctrl-V`         | verbatim character\n`Ctrl-W`         | jump back one dir/file/context\n`Ctrl-X` `F3`    | set bookmark\n`Ctrl-Y` `F2`    | view or edit the file shown at the top of the screen\n`Ctrl-Z` `F1`    | view help and options\n`Ctrl-^`         | chdir back to the starting working directory\n`Ctrl-]`         | toggle color/mono\n`Ctrl-\\`         | terminate process\n\nTo interactively search the files in the working directory and below:\n\n    ug -Q\n\nSame, but restricted to C++ files only and ignoring `.gitignore` files:\n\n    ug -Q -tc++ --ignore-files\n\nTo interactively search all makefiles in the working directory and below:\n\n    ug -Q -g 'Makefile*' -g 'makefile*'\n\nSame, but for up to 2 directory levels (working and one subdirectory level):\n\n    ug -Q -2 -g 'Makefile*' -g 'makefile*'\n\nTo interactively view the contents of `main.cpp` and search it, where `-y`\nshows any nonmatching lines as context:\n\n    ug -Q -y main.cpp\n\nTo interactively search `main.cpp`, starting with the search pattern `TODO` and\na match context of 5 lines (context can be interactively enabled and disabled,\nthis also overrides the default context size of 2 lines):\n\n    ug -Q -C5 -e TODO main.cpp\n\nTo view and search the contents of an archive (e.g. zip, tarball):\n\n    ug -Q -z archive.tar.gz\n\nTo interactively select files from `project.zip` to decompress with `unzip`,\nusing ugrep query selection mode (press Enter to select lines):\n\n    unzip project.zip `zipinfo -1 project.zip | ugrep -Q`\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"recursion\"/\u003e\n\n### Recursively list matching files with -l, -R, -r, -S, --depth, -g, -O, and -t\n\n    -L, --files-without-match\n            Only the names of files not containing selected lines are written\n            to standard output.  Pathnames are listed once per file searched.\n            If the standard input is searched, the string ``(standard input)''\n            is written.\n    -l, --files-with-matches\n            Only the names of files containing selected lines are written to\n            standard output.  ugrep will only search a file until a match has\n            been found, making searches potentially less expensive.  Pathnames\n            are listed once per file searched.  If the standard input is\n            searched, the string ``(standard input)'' is written.\n    -R, --dereference-recursive\n            Recursively read all files under each directory.  Follow all\n            symbolic links to files and directories, unlike -r.\n    -r, --recursive\n            Recursively read all files under each directory, following symbolic\n            links only if they are on the command line.  Note that when no FILE\n            arguments are specified and input is read from a terminal,\n            recursive searches are performed as if -r is specified.\n    -S, --dereference-files\n            When -r is specified, symbolic links to files are followed, but not\n            to directories.  The default is not to follow symbolic links.\n    --depth=[MIN,][MAX], -1, -2, -3, ... -9, -10, -11, -12, ...\n            Restrict recursive searches from MIN to MAX directory levels deep,\n            where -1 (--depth=1) searches the specified path without recursing\n            into subdirectories.  Note that -3 -5, -3-5, and -35 search 3 to 5\n            levels deep.  Enables -r if -R or -r is not specified.\n    -g GLOBS, --glob=GLOBS\n            Search only files whose name matches the specified comma-separated\n            list of GLOBS, same as --include='glob' for each `glob' in GLOBS.\n            When a `glob' is preceded by a `!' or a `^', skip files whose name\n            matches `glob', same as --exclude='glob'.  When `glob' contains a\n            `/', full pathnames are matched.  Otherwise basenames are matched.\n            When `glob' ends with a `/', directories are matched, same as\n            --include-dir='glob' and --exclude-dir='glob'.  A leading `/'\n            matches the working directory.  This option may be repeated and may\n            be combined with options -M, -O and -t to expand searches.  See\n            `ugrep --help globs' and `man ugrep' section GLOBBING for details.\n    -O EXTENSIONS, --file-extension=EXTENSIONS\n            Search only files whose filename extensions match the specified\n            comma-separated list of EXTENSIONS, same as --include='*.ext' for\n            each `ext' in EXTENSIONS.  When `ext' is preceded by a `!' or a\n            `^', skip files whose filename extensions matches `ext', same as\n            --exclude='*.ext'.  This option may be repeated and may be combined\n            with options -g, -M and -t to expand the recursive search.\n    -t TYPES, --file-type=TYPES\n            Search only files associated with TYPES, a comma-separated list of\n            file types.  Each file type corresponds to a set of filename\n            extensions passed to option -O and filenames passed to option -g.\n            For capitalized file types, the search is expanded to include files\n            with matching file signature magic bytes, as if passed to option\n            -M.  When a type is preceded by a `!' or a `^', excludes files of\n            the specified type.  This option may be repeated.\n    --stats\n            Output statistics on the number of files and directories searched,\n            and the inclusion and exclusion constraints applied.\n\nIf no FILE arguments are specified and input is read from a terminal, recursive\nsearches are performed as if `-r` is specified.  To force reading from standard\ninput, specify `-` as the FILE argument.\n\nTo recursively list all non-empty files in the working directory:\n\n    ug -r -l ''\n\nTo list all non-empty files in the working directory but not deeper (since a\nFILE argument is given, in this case `.` for the working directory):\n\n    ug -l '' .\n\nTo list all non-empty files in directory `mydir` but not deeper (since a FILE\nargument is given):\n\n    ug -l '' mydir\n\nTo list all non-empty files in directory `mydir` and deeper while following\nsymlinks:\n\n    ug -R -l '' mydir\n\nTo recursively list all non-empty files on the path specified, while visiting\nsubdirectories only, i.e. directories `mydir/` and subdirectories at one\nlevel deeper `mydir/*/` are visited (note that `-2 -l` can be abbreviated to\n`-l2`):\n\n    ug -2 -l '' mydir\n\nTo recursively list all non-empty files in directory `mydir`, not following any\nsymbolic links (except when on the command line such as `mydir`):\n\n    ug -rl '' mydir\n\nTo recursively list all Makefiles matching the text `CPP`:\n\n    ug -l -tmake 'CPP'\n\nTo recursively list all `Makefile.*` matching `bin_PROGRAMS`:\n\n    ug -l -g'Makefile.*' 'bin_PROGRAMS'\n\nTo recursively list all non-empty files with extension .sh, with `-Osh`:\n\n    ug -l -Osh ''\n\nTo recursively list all shell scripts based on extensions and shebangs with\n`-tShell`:\n\n    ug -l -tShell ''\n\nTo recursively list all shell scripts based on extensions only with `-tshell`:\n\n    ug -l -tshell ''\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"bool\"/\u003e\n\n### Boolean query patterns with -%, -%%, --and, --not\n\n    --bool, -%, -%%\n            Specifies Boolean query patterns.  A Boolean query pattern is\n            composed of `AND', `OR', `NOT' operators and grouping with `(' `)'.\n            Spacing between subpatterns is the same as `AND', `|' is the same\n            as `OR' and a `-' is the same as `NOT'.  The `OR' operator binds\n            more tightly than `AND'.  For example, --bool 'A|B C|D' matches\n            lines with (`A' or `B') and (`C' or `D'), --bool 'A -B' matches\n            lines with `A' and not `B'.  Operators `AND', `OR', `NOT' require\n            proper spacing.  For example, --bool 'A OR B AND C OR D' matches\n            lines with (`A' or `B') and (`C' or `D'), --bool 'A AND NOT B'\n            matches lines with `A' without `B'.  Quoted subpatterns are matched\n            literally as strings.  For example, --bool 'A \"AND\"|\"OR\"' matches\n            lines with `A' and also either `AND' or `OR'.  Parentheses are used\n            for grouping.  For example, --bool '(A B)|C' matches lines with `A'\n            and `B', or lines with `C'.  Note that all subpatterns in a Boolean\n            query pattern are regular expressions, unless -F is specified.\n            Options -E, -F, -G, -P and -Z can be combined with --bool to match\n            subpatterns as strings or regular expressions (-E is the default.)\n            This option does not apply to -f FILE patterns.  The double short\n            option -%% enables options --bool --files.  Option --stats displays\n            the Boolean search patterns applied.  See also options --and,\n            --andnot, --not, --files and --lines.\n    --files\n            Boolean file matching mode, the opposite of --lines.  When combined\n            with option --bool, matches a file if all Boolean conditions are\n            satisfied.  For example, --bool --files 'A B|C -D' matches a file\n            if some lines match `A', and some lines match either `B' or `C',\n            and no line matches `D'.  See also options --and, --andnot, --not,\n            --bool and --lines.  The double short option -%% enables options\n            --bool --files.\n    --lines\n            Boolean line matching mode for option --bool, the default mode.\n    --and [[-e] PATTERN] ... -e PATTERN\n            Specify additional patterns to match.  Patterns must be specified\n            with -e.  Each -e PATTERN following this option is considered an\n            alternative pattern to match, i.e. each -e is interpreted as an OR\n            pattern.  For example, -e A -e B --and -e C -e D matches lines with\n            (`A' or `B') and (`C' or `D').  Note that multiple -e PATTERN are\n            alternations that bind more tightly together than --and.  Option\n            --stats displays the search patterns applied.  See also options\n            --not, --andnot, and --bool.\n    --andnot [[-e] PATTERN] ...\n            Combines --and --not.  See also options --and, --not, and --bool.\n    --not [-e] PATTERN\n            Specifies that PATTERN should not match.  Note that -e A --not -e B\n            matches lines with `A' or lines without a `B'.  To match lines with\n            `A' that have no `B', specify -e A --andnot -e B.  Option --stats\n            displays the search patterns applied.  See also options --and,\n            --andnot, and --bool.\n    --stats\n            Output statistics on the number of files and directories searched,\n            and the inclusion and exclusion constraints applied.\n\nNote that the `--and`, `--not`, and `--andnot` options require `-e PATTERN`.\n\nThe `-%` option makes all patterns Boolean-based, supporting the following\nlogical operations listed from the highest level of precedence to the lowest:\n\noperator | alternative | result\n-------- | ----------- | -------\n`\"x\"`    |             | match `x` literally and exactly as specified (using the standard regex escapes `\\Q` and `\\E`)\n`( )`    |             | Boolean expression grouping\n`-x`     | `NOT x`     | inverted match, i.e. matches if `x` does not match\n`x\\|y`   | `x OR y`    | matches lines with `x` or `y`\n`x y`    | `x AND y`   | matches lines with both `x` and `y`\n\n- `x` and `y` are subpatterns that do not start with the special symbols `|`,\n  `-`, and `(` (use quotes or a `\\` escape to match these);\n\n- `-` and `NOT` are the same and take precedence over `OR`, which means that\n  `-x|y` == `(-x)|y` for example.\n\n- `|` and `OR` are the same and take precedence over `AND`, which means that\n  `x y|z` == `x (y|z)` for example;\n\nThe `--stats` option displays the Boolean queries in human-readable form\nconverted to CNF (Conjunctive Normal Form), after the search is completed.\nTo show the CNF without a search, read from standard input terminated by an\nEOF, like `echo | ugrep -% '...' --stats`.\n\nSubpatterns are color-highlighted in the output, except those negated with\n`NOT` (a `NOT` subpattern may still show up in a matching line when using an\nOR-NOT pattern like `x|-y`).  Note that subpatterns may overlap.  In that\ncase only the first matching subpattern is color-highlighted.\n\nMultiple lines may be matched when subpatterns match newlines.  There is one\nexception however: subpatterns ending with `(?=X)` lookaheads may not match\nwhen `X` spans multiple lines.\n\nEmpty patterns match any line (grep standard).  Therefore, `-% 'x|\"\"|y'`\nmatches everything and `x` and `y` are not color-highlighted.  Option `-y`\nshould be used to show every line as context, for example `-y 'x|y'`.\n\nFzf-like interactive querying (Boolean search with fixed strings with fuzzy\nmatching to allow e.g. up to 4 extra characters matched with `-Z+4` in words\nwith `-w`), press TAB and ALT-y to view a file with matches.  Press SHIFT-TAB\nand ALT-l to go back to the list of matching files:\n\n    ug -Q -%% -l -w -F -Z+4 --sort=best\n\nTo recursively find all files containing both `hot` and `dog` anywhere in the\nfile with option `--files`:\n\n    ug -%% 'hot dog'\n    ug --files -e hot --and dog\n\nTo find lines containing both `hot` and `dog` in `myfile.txt`:\n\n    ug -% 'hot dog' myfile.txt\n    ug -e hot --and dog myfile.txt\n\nTo find lines containing `place` and then also `hotdog` or `taco` (or both) in\n`myfile.txt`:\n\n    ug -% 'hotdog|taco place' myfile.txt\n    ug -e hotdog -e taco --and place myfile.txt\n\nSame, but exclude lines matching `diner`:\n\n    ug -% 'hotdog|taco place -diner' myfile.txt\n    ug -e hotdog -e taco --and place --andnot diner myfile.txt\n\nTo find lines with `diner` or lines that match both `fast` and `food` but not `bad` in `myfile.txt`:\n\n    ug -% 'diner|(fast food -bad)' myfile.txt\n\nTo find lines with `fast food` (exactly) or lines with `diner` but not `bad` or `old` in `myfile.txt`:\n\n    ug -% '\"fast food\"|diner -bad -old' myfile.txt\n\nSame, but using a different Boolean expression that has the same meaning:\n\n    ug -% '\"fast food\"|diner -(bad|old)' myfile.txt\n\nTo find lines with `diner` implying `good` in `myfile.txt` (that is, show lines\nwith `good` without `diner` and show lines with `diner` but only those with\n`good`, which is logically implied!):\n\n    ug -% 'good|-diner' myfile.txt\n    ug -e good --not diner myfile.txt\n\nTo find lines with `foo` and `-bar` and `\"baz\"` in `myfile.txt` (not that `-`\nand `\"` should be matched using `\\` escapes and with `--and -e -bar`):\n\n    ug -% 'foo \\-bar \\\"baz\\\"' myfile.txt\n    ug -e foo --and -e -bar --and '\"baz\"' myfile.txt\n\nTo search `myfile.cpp` for lines with `TODO` or `FIXME` but not both on the\nsame line, like XOR:\n\n    ug -% 'TODO|FIXME -(TODO FIXME)' myfile.cpp\n    ug -e TODO -e FIXME --and --not TODO --not FIXME myfile.cpp\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"not\"/\u003e\n\n### Search this but not that with -v, -e, -N, -f, -L, -w, -x\n\n    -e PATTERN, --regexp=PATTERN\n            Specify a PATTERN to search the input.  An input line is selected\n            if it matches any of the specified patterns.  This option is useful\n            when multiple -e options are used to specify multiple patterns, or\n            when a pattern begins with a dash (`-'), or to specify a pattern\n            after option -f or after the FILE arguments.\n    -f FILE, --file=FILE\n            Read newline-separated patterns from FILE.  White space in patterns\n            is significant.  Empty lines in FILE are ignored.  If FILE does not\n            exist, the GREP_PATH environment variable is used as path to FILE.\n            If that fails, looks for FILE in /usr/local/share/ugrep/pattern.\n            When FILE is a `-', standard input is read.  This option may be\n            repeated.\n    -L, --files-without-match\n            Only the names of files not containing selected lines are written\n            to standard output.  Pathnames are listed once per file searched.\n            If the standard input is searched, the string ``(standard input)''\n            is written.\n    -N PATTERN, --neg-regexp=PATTERN\n            Specify a negative PATTERN to reject specific -e PATTERN matches\n            with a counter pattern.  Note that longer patterns take precedence\n            over shorter patterns, i.e. a negative pattern must be of the same\n            length or longer to reject matching patterns.  Option -N cannot be\n            specified with -P.  This option may be repeated.\n    -v, --invert-match\n            Selected lines are those not matching any of the specified\n            patterns.\n    -w, --word-regexp\n            The PATTERN is searched for as a word, such that the matching text\n            is preceded by a non-word character and is followed by a non-word\n            character.  Word-like characters are Unicode letters, digits and\n            connector punctuations such as underscore.\n    -x, --line-regexp\n            Select only those matches that exactly match the whole line, as if\n            the patterns are surrounded by ^ and $.\n\nSee also [Boolean query patterns with -%, -%%, --and, --not](#bool) for\nmore powerful Boolean query options than the traditional GNU/BSD grep options.\n\nTo display lines in file `myfile.sh` but not lines matching `^[ \\t]*#`:\n\n    ug -v '^[ \\t]*#' myfile.sh\n\nTo search `myfile.cpp` for lines with `FIXME` and `urgent`, but not `Scotty`:\n\n    ugrep FIXME myfile.cpp | ugrep urgent | ugrep -v Scotty\n\nSame, but using `-%` for Boolean queries:\n\n    ug -% 'FIXME urgent -Scotty' myfile.cpp\n\nTo search for decimals using pattern `\\d+` that do not start with `0` using\nnegative pattern `0\\d+` and excluding `555`:\n\n    ug -e '\\d+' -N '0\\d+' -N 555 myfile.cpp\n\nTo search for words starting with `disp` without matching `display` in file\n`myfile.py` by using a \"negative pattern\" `-N '/\u003cdisplay\\\u003e'` where `-N`\nspecifies an additional negative pattern to skip matches:\n\n    ug -e '\\\u003cdisp' -N '\\\u003cdisplay\\\u003e' myfile.py\n\nTo search for lines with the word `display` in file `myfile.py` skipping this\nword in strings and comments, where `-f` specifies patterns in files which are\npredefined patterns in this case:\n\n    ug -n -w 'display' -f python/zap_strings -f python/zap_comments myfile.py\n\nTo display lines that are not blank lines:\n\n    ug -x -e '.*' -N '\\h*' myfile.py\n\nSame, but using `-v` and `-x` with `\\h*`, i.e. pattern `^\\h*$`:\n\n    ug -v -x '\\h*' myfile.py\n\nTo recursively list all Python files that do not contain the word `display`,\nallowing the word to occur in strings and comments:\n\n    ug -RL -tPython -w 'display' -f python/zap_strings -f python/zap_comments\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"encoding\"/\u003e\n\n### Search non-Unicode files with --encoding\n\n    --encoding=ENCODING\n            The encoding format of the input.  The default ENCODING is binary\n            and UTF-8 which are the same.  Note that option -U specifies binary\n            PATTERN matching (text matching is the default.)\n\nBinary, ASCII and UTF-8 files do not require this option to search them.  Also\nUTF-16 and UTF-32 files do not require this option to search them, assuming\nthat UTF-16 and UTF-32 files start with a UTF BOM\n([byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark)) as usual.\nOther file encodings require option `--encoding=ENCODING`:\n\nencoding               | parameter\n---------------------- | --------------\nASCII                  | *n/a*\nUTF-8                  | *n/a*\nUTF-16 with BOM        | *n/a*\nUTF-32 with BOM        | *n/a*\nUTF-16 BE w/o BOM      | `UTF-16` or `UTF-16BE`\nUTF-16 LE w/o BOM      | `UTF-16LE`\nUTF-32 w/o BOM         | `UTF-32` or `UTF-32BE`\nUTF-32 w/o BOM         | `UTF-32LE`\nLatin-1                | `LATIN1` or `ISO-8859-1`\nISO-8859-1             | `ISO-8859-1`\nISO-8859-2             | `ISO-8859-2`\nISO-8859-3             | `ISO-8859-3`\nISO-8859-4             | `ISO-8859-4`\nISO-8859-5             | `ISO-8859-5`\nISO-8859-6             | `ISO-8859-6`\nISO-8859-7             | `ISO-8859-7`\nISO-8859-8             | `ISO-8859-8`\nISO-8859-9             | `ISO-8859-9`\nISO-8859-10            | `ISO-8859-10`\nISO-8859-11            | `ISO-8859-11`\nISO-8859-13            | `ISO-8859-13`\nISO-8859-14            | `ISO-8859-14`\nISO-8859-15            | `ISO-8859-15`\nISO-8859-16            | `ISO-8859-16`\nMAC (CR=newline)       | `MAC`\nMacRoman (CR=newline)  | `MACROMAN`\nEBCDIC                 | `EBCDIC`\nDOS code page 437      | `CP437`\nDOS code page 850      | `CP850`\nDOS code page 858      | `CP858`\nWindows code page 1250 | `CP1250`\nWindows code page 1251 | `CP1251`\nWindows code page 1252 | `CP1252`\nWindows code page 1253 | `CP1253`\nWindows code page 1254 | `CP1254`\nWindows code page 1255 | `CP1255`\nWindows code page 1256 | `CP1256`\nWindows code page 1257 | `CP1257`\nWindows code page 1258 | `CP1258`\nKOI8-R                 | `KOI8-R`\nKOI8-U                 | `KOI8-U`\nKOI8-RU                | `KOI8-RU`\n\nNote that regex patterns are always specified in UTF-8 (includes ASCII).  To\nsearch binary files with binary patterns, see\n[searching and displaying binary files with -U, -W, and -X](#binary).\n\nTo recursively list all files that are ASCII (i.e. 7-bit):\n\n    ug -L '[^[:ascii:]]'\n\nTo recursively list all files that are non-ASCII, i.e. UTF-8, UTF-16, and\nUTF-32 files with non-ASCII Unicode characters (U+0080 and up):\n\n    ug -l '[^[:ascii:]]'\n\nTo check if a file contains non-ASCII Unicode (U+0080 and up):\n\n    ug -q '[^[:ascii:]]' myfile \u0026\u0026 echo \"contains Unicode\"\n\nTo remove invalid Unicode characters from a file (note that `-o` may not work\nbecause binary data is detected and rejected and newlines are added, but\n`--format=\"%o%` does not check for binary and copies the match \"as is\"):\n\n    ug \"[\\p{Unicode}\\n]\" --format=\"%o\" badfile.txt\n\nTo recursively list files with invalid UTF content (i.e. invalid UTF-8 byte\nsequences or files that contain any UTF-8/16/32 code points that are outside\nthe valid Unicode range) by matching any code point with `.` and by using a\nnegative pattern `-N '\\p{Unicode}'` to ignore each valid Unicode character:\n\n    ug -l -e '.' -N '\\p{Unicode}'\n\nTo display lines containing laughing face emojis:\n\n    ug '[😀-😏]' emojis.txt\n\nThe same results are obtained using `\\x{hhhh}` to select a Unicode character\nrange:\n\n    ug '[\\x{1F600}-\\x{1F60F}]' emojis.txt\n\nTo display lines containing the names Gödel (or Goedel), Escher, or Bach:\n\n    ug 'G(ö|oe)del|Escher|Bach' GEB.txt wiki.txt\n\nTo search for `lorem` in lower or upper case in a UTF-16 file that is marked\nwith a UTF-16 BOM:\n\n    ug -iw 'lorem' utf16lorem.txt\n\nTo search utf16lorem.txt when this file has no UTF-16 BOM, using `--encoding`:\n\n    ug --encoding=UTF-16 -iw 'lorem' utf16lorem.txt\n\nTo search file `spanish-iso.txt` encoded in ISO-8859-1:\n\n    ug --encoding=ISO-8859-1 -w 'año' spanish-iso.txt\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"multiline\"/\u003e\n\n### Matching multiple lines of text\n\n    -o, --only-matching\n            Output only the matching part of lines.  If -A, -B or -C is\n            specified, fits the match and its context on a line within the\n            specified number of columns.\n\nMultiple lines may be matched by patterns that match newline characters.  Use\noption `-o` to output the match only, not the full lines(s) that match.\n\nTo match a `\\n` line break, include `\\n` in the pattern to match the LF\ncharacter.  If you want to match `\\r\\n` and `\\n` line breaks, use `\\r?\\n` or\nsimply use `\\R` to match any Unicode line break `\\r\\n`, `\\r`, `\\v`, `\\f`, `\\n`,\nU+0085, U+2028 and U+2029.\n\nTo match C/C++ `/*...*/` multi-line comments:\n\n    ug '/\\*(.*\\n)*?.*\\*+\\/' myfile.cpp\n\nTo match C/C++ comments using the predefined `c/comments` patterns with\n`-f c/comments`, restricted to the matching part only with option `-o`:\n\n    ug -of c/comments myfile.cpp\n\nSame as `sed -n '/begin/,/end/p'`: to match all lines between a line containing\n`begin` and the first line after that containing `end`, using lazy repetition:\n\n    ug -o '.*begin(.|\\n)*?end.*' myfile.txt\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"context\"/\u003e\n\n### Displaying match context with -A, -B, -C, -y, and --width\n\n    -A NUM, --after-context=NUM\n            Output NUM lines of trailing context after matching lines.  Places\n            a --group-separator between contiguous groups of matches.  If -o is\n            specified, output the match with context to fit NUM columns after\n            the match or shortens the match.  See also options -B, -C and -y.\n    -B NUM, --before-context=NUM\n            Output NUM lines of leading context before matching lines.  Places\n            a --group-separator between contiguous groups of matches.  If -o is\n            specified, output the match with context to fit NUM columns before\n            the match or shortens the match.  See also options -A, -C and -y.\n    -C NUM, --context=NUM\n            Output NUM lines of leading and trailing context surrounding each\n            matching line.  Places a --group-separator between contiguous\n            groups of matches.  If -o is specified, output the match with\n            context to fit NUM columns before and after the match or shortens\n            the match.  See also options -A, -B and -y.\n    -y, --any-line\n            Any line is output (passthru).  Non-matching lines are output as\n            context with a `-' separator.  See also options -A, -B, and -C.\n    --width[=NUM]\n            Truncate the output to NUM visible characters per line.  The width\n            of the terminal window is used if NUM is not specified.  Note that\n            double wide characters in the output may result in wider lines.\n    -o, --only-matching\n            Output only the matching part of lines.  If -A, -B or -C is\n            specified, fits the match and its context on a line within the\n            specified number of columns.\n\nTo display two lines of context before and after a matching line:\n\n    ug -C2 'FIXME' myfile.cpp\n\nTo show three lines of context after a matched line:\n\n    ug -A3 'FIXME.*' myfile.cpp:\n\nTo display one line of context before each matching line with a C function\ndefinition (C names are non-Unicode):\n\n    ug -B1 -f c/functions myfile.c\n\nTo display one line of context before each matching line with a C++ function\ndefinition (C++ names may be Unicode):\n\n    ug -B1 -f c++/functions myfile.cpp\n\nTo display any non-matching lines as context for matching lines with `-y`:\n\n    ug -y -f c++/functions myfile.cpp\n\nTo display a hexdump of a matching line with one line of hexdump context:\n\n    ug -C1 -UX '\\xaa\\xbb\\xcc' a.out\n\nContext within a line is displayed with option `-o` with a context option:\n\n    ug -o -C20 'pattern' myfile.cpp\n\nSame, but with pretty output with headings, line numbers and column numbers\n(`-k`) and showing context:\n\n    ug --pretty -oC20 'pattern' myfile.cpp\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"source\"/\u003e\n\n### Searching source code using -f, -g, -O, and -t\n\n    -f FILE, --file=FILE\n            Read newline-separated patterns from FILE.  White space in patterns\n            is significant.  Empty lines in FILE are ignored.  If FILE does not\n            exist, the GREP_PATH environment variable is used as path to FILE.\n            If that fails, looks for FILE in /usr/local/share/ugrep/pattern.\n            When FILE is a `-', standard input is read.  This option may be\n            repeated.\n    --ignore-files[=FILE]\n            Ignore files and directories matching the globs in each FILE that\n            is encountered in recursive searches.  The default FILE is\n            `.gitignore'.  Matching files and directories located in the\n            directory of the FILE and in subdirectories below are ignored.\n            Globbing syntax is the same as the --exclude-from=FILE gitignore\n            syntax, but files and directories are excluded instead of only\n            files.  Directories are specifically excluded when the glob ends in\n            a `/'.  Files and directories explicitly specified as command line\n            arguments are never ignored.  This option may be repeated to\n            specify additional files.\n    -g GLOBS, --glob=GLOBS\n            Search only files whose name matches the specified comma-separated\n            list of GLOBS, same as --include='glob' for each `glob' in GLOBS.\n            When a `glob' is preceded by a `!' or a `^', skip files whose name\n            matches `glob', same as --exclude='glob'.  When `glob' contains a\n            `/', full pathnames are matched.  Otherwise basenames are matched.\n            When `glob' ends with a `/', directories are matched, same as\n            --include-dir='glob' and --exclude-dir='glob'.  A leading `/'\n            matches the working directory.  This option may be repeated and may\n            be combined with options -M, -O and -t to expand searches.  See\n            `ugrep --help globs' and `man ugrep' section GLOBBING for details.\n    -O EXTENSIONS, --file-extension=EXTENSIONS\n            Search only files whose filename extensions match the specified\n            comma-separated list of EXTENSIONS, same as --include='*.ext' for\n            each `ext' in EXTENSIONS.  When `ext' is preceded by a `!' or a\n            `^', skip files whose filename extensions matches `ext', same as\n            --exclude='*.ext'.  This option may be repeated and may be combined\n            with options -g, -M and -t to expand the recursive search.\n    -t TYPES, --file-type=TYPES\n            Search only files associated with TYPES, a comma-separated list of\n            file types.  Each file type corresponds to a set of filename\n            extensions passed to option -O and filenames passed to option -g.\n            For capitalized file types, the search is expanded to include files\n            with matching file signature magic bytes, as if passed to option\n            -M.  When a type is preceded by a `!' or a `^', excludes files of\n            the specified type.  This option may be repeated.\n    --stats\n            Output statistics on the number of files and directories searched,\n            and the inclusion and exclusion constraints applied.\n\nThe file types are listed with `ugrep -tlist`.  The list is based on\nestablished filename extensions and \"magic bytes\".  If you have a file type\nthat is not listed, use options `-O` and/or `-M`.  You may want to define an\nalias, e.g. `alias ugft='ugrep -Oft'` as a shorthand to search files with\nfilename suffix `.ft`.\n\nTo recursively display function definitions in C/C++ files (`.h`, `.hpp`, `.c`,\n`.cpp` etc.) with line numbers with `-tc++`, `-o`, `-n`, and `-f c++/functions`:\n\n    ug -on -tc++ -f c++/functions\n\nTo recursively display function definitions in `.c` and `.cpp` files with line\nnumbers with `-Oc,cpp`, `-o`, `-n`, and `-f c++/functions`:\n\n    ug -on -Oc,cpp -f c++/functions\n\nTo recursively list all shell files with `-tShell` to match filename extensions\nand files with shell shebangs, except files with suffix `.sh`:\n\n    ug -l -tShell -O^sh ''\n\nTo recursively list all non-shell files with `-t^Shell`:\n\n    ug -l -t^Shell ''\n\nTo recursively list all shell files with shell shebangs that have no shell\nfilename extensions:\n\n    ug -l -tShell -t^shell ''\n\nTo search for lines with `FIXME` in C/C++ comments, excluding `FIXME` in\nmulti-line strings:\n\n    ug -n 'FIXME' -f c++/zap_strings myfile.cpp\n\nTo read patterns `TODO` and `FIXME` from standard input to match lines in the\ninput, while excluding matches in C++ strings:\n\n    ug -on -f - -f c++/zap_strings myfile.cpp \u003c\u003cEND\n    TODO\n    FIXME\n    END\n\nTo display XML element and attribute tags in an XML file, restricted to the\nmatching part with `-o`, excluding tags that are placed in (multi-line)\ncomments:\n\n    ug -o -f xml/tags -f xml/zap_comments myfile.xml\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"archives\"/\u003e\n\n### Searching compressed files and archives with -z\n\n    -z, --decompress\n            Search compressed files and archives.  Archives (.cpio, .pax, .tar)\n            and compressed archives (e.g. .zip, .7z, .taz, .tgz, .tpz, .tbz,\n            .tbz2, .tb2, .tz2, .tlz, .txz, .tzst) are searched and matching\n            pathnames of files in archives are output in braces.  When used\n            with option --zmax=NUM, searches the contents of compressed files\n            and archives stored within archives up to NUM levels.  If -g, -O,\n            -M, or -t is specified, searches files stored in archives whose\n            filenames match globs, match filename extensions, match file\n            signature magic bytes, or match file types, respectively.\n            Supported compression formats: gzip (.gz), compress (.Z), zip, 7z,\n            bzip2 (requires suffix .bz, .bz2, .bzip2, .tbz, .tbz2, .tb2, .tz2),\n            lzma and xz (requires suffix .lzma, .tlz, .xz, .txz),\n            lz4 (requires suffix .lz4),\n            zstd (requires suffix .zst, .zstd, .tzst),\n            brotli (requires suffix .br),\n            bzip3 (requires suffix .bz3).\n    --zmax=NUM\n            When used with option -z (--decompress), searches the contents of\n            compressed files and archives stored within archives by up to NUM\n            expansion stages.  The default --zmax=1 only permits searching\n            uncompressed files stored in cpio, pax, tar, zip and 7z archives;\n            compressed files and archives are detected as binary files and are\n            effectively ignored.  Specify --zmax=2 to search compressed files\n            and archives stored in cpio, pax, tar, zip and 7z archives.  NUM\n            may range from 1 to 99 for up to 99 decompression and de-archiving\n            steps.  Increasing NUM values gradually degrades performance.\n\nFiles compressed with gzip (`.gz`), compress (`.Z`), bzip2 (`.bz`, `.bz2`,\n`.bzip2`), lzma (`.lzma`), xz (`.xz`), lz4 (`.lz4`), zstd (`.zst`, `.zstd`),\nbrotli (`.br`) and bzip3 (`.bz3`) are searched with option `-z` when the\ncorresponding libraries are installed and compiled with ugrep.  This option\ndoes not require files to be compressed.  Uncompressed files are searched also,\nalthough slower.\n\nOther compression formats can be searched with **ugrep** [filters](#filter).\n\nArchives (cpio, jar, pax, tar, zip and 7z) are searched with option `-z`.\nRegular files in an archive that match are output with the archive pathnames\nenclosed in `{` and `}` braces.  Supported tar formats are v7, ustar, gnu,\noldgnu, and pax.  Supported cpio formats are odc, newc, and crc.  Not supported\nis the obsolete non-portable old binary cpio format.  Archive formats cpio,\ntar, and pax are automatically recognized with option `-z` based on their\ncontent, independent of their filename suffix.\n\nBy default, uncompressed archives stored within zip archives are also searched:\nall cpio, pax, and tar files stored in zip and 7z archives are automatically\nrecognized and searched.  However, by default, compressed files stored within\narchives are not recognized, e.g. zip files stored within tar files are not\nsearched but rather all compressed files and archives are searched as if they\nare binary files without decompressing them.\n\nSpecify `--zmax=NUM` to search archives that contain compressed files and\narchives for up to `NUM` levels deep.  The value of `NUM` may range from 1 to\n99 for up to 99 decompression and de-archiving steps to expand up to 99 nested\narchives.  Larger `--zmax=NUM` values degrade performance.  It is unlikely you\nwill ever need 99 as `--zmax=2` suffices for most practical use cases, such as\nsearching zip files stored in tar files.\n\nWhen option `-z` is used with options `-g`, `-O`, `-M`, or `-t`, archives and\ncompressed and uncompressed files that match the filename selection criteria\n(glob, extension, magic bytes, or file type) are searched only.  For example,\n`ugrep -r -z -tc++` searches C++ files such as `main.cpp` and zip and tar\narchives that contain C++ files such as `main.cpp`.  Also included in the\nsearch are compressed C++ files such as `main.cpp.gz` and `main.cpp.xz` when\npresent.  Also any cpio, pax, tar, zip and 7z archives when present are\nsearched for C++ files that they contain, such as `main.cpp`.  Use option\n`--stats` to see a list of the glob patterns applied to filter file pathnames\nin the recursive search and when searching archive contents.\n\nWhen option `-z` is used with options `-g`, `-O`, `-M`, or `-t` to search cpio,\njar, pax, tar, zip and 7z archives, archived files that match the filename\nselection criteria are searched only.\n\nThe gzip, compress, and zip formats are automatically detected, which is useful\nwhen reading gzip-compressed data from standard input, e.g. input redirected\nfrom a pipe.  Other compression formats require a filename suffix: `.bz`,\n`.bz2`, or `.bzip2` for bzip2, `.lzma` for lzma, `.xz` for xz, `.lz4` for lz4,\n`.zst` or `.zstd` for zstd, `.br` for brotli and `.bz3` for bzip3.  Also the\ncompressed tar archive shorthands `.taz`, `.tgz` and `.tpz` for gzip, `.tbz`,\n`.tbz2`, `.tb2`, and `.tz2` for bzip2, `.tlz` for lzma, `.txz` for xz, and\n`.tzst` for zstd are recognized.  To search these formats with ugrep from\nstandard input, use option `--label='stdin.bz2'` for bzip2,\n`--label='stdin.lzma'` for lzma, `--label='stdin.xz'` for xz,\n`--label='stdin.lz4` for lz4 and `--label='stdin.zst` for zstd and so on.  The\nname `stdin` is arbitrary and may be omitted:\n\nformat    | filename suffix         | tar/pax archive short suffix    | suffix required? | ugrep from stdin | library      |\n--------- | ----------------------- | ------------------------------- | ---------------- | ---------------- | ------------ |\ngzip      | `.gz`                   | `.taz`, `.tgz`, `.tpz`          | no               | automatic        | libz         |\ncompress  | `.Z`                    | `.taZ`, `.tZ`                   | no               | automatic        | *built-in*   |\nzip       | `.zip`, `.zipx`, `.ZIP` |                                 | no               | automatic        | libz         |\n7zip      | `.7z`                   |                                 | yes              | `--label=.7z`    | *built-in*   |\nbzip2     | `.bz`, `.bz2`, `.bzip2` | `.tb2`, `.tbz`, `.tbz2`, `.tz2` | yes              | `--label=.bz2`   | libbz2       |\nlzma      | `.lzma`                 | `.tlz`                          | yes              | `--label=.lzma`  | liblzma      |\nxz        | `.xz`                   | `.txz`                          | yes              | `--label=.xz`    | liblzma      |\nlz4       | `.lz4`                  |                                 | yes              | `--label=.lz4`   | liblz4       |\nzstd      | `.zst`, `.zstd`         | `.tzst`                         | yes              | `--label=.zst`   | libzstd      |\nbrotli    | `.br`                   |                                 | yes              | `--label=.br`    | libbrotlidec |\nbzip3     | `.bz3`                  |                                 | yes              | `--label=.bz3`   | libbzip3     |\n\nThe gzip, bzip2, xz, lz4 and zstd formats support concatenated compressed\nfiles.  Concatenated compressed files are searched as one single file.\n\nSupported zip compression methods are stored (0), deflate (8), bzip2 (12), lzma\n(14), xz (95) and zstd (93).  The bzip2, lzma, xz and zstd methods require\nugrep to be compiled with the corresponding compression libraries.\n\nSearching encrypted zip archives is not supported (perhaps in future releases,\ndepending on requests for enhancements).\n\nSearching 7zip archives takes a lot more RAM and more time compared to other\nmethods.  The 7zip LZMA SDK implementation does not support streaming,\nrequiring a physical seekable 7z file.  This means that 7z files cannot be\nsearched when nested within archives.  Best is to avoid 7zip.  Support for 7zip\ncan be disabled with `./build.sh --disable-7zip` to build ugrep.\n\nOption `-z` uses threads for task parallelism to speed up searching larger\nfiles by running the decompressor concurrently with a search of the\ndecompressed stream.\n\nTo list all non-empty files stored in a `package.zip` archive, including the\ncontents of all cpio, pax, tar, zip and 7z files that are stored in it:\n\n    ug --zmax=2 -z -l '' package.zip\n\nSame, but only list the Python source code files, including scripts that invoke\nPython, with option `-tPython` (`ugrep -tlist` for details):\n\n    ug --zmax=2 -z -l -tPython '' package.zip\n\nTo search Python applications distributed as a tar file with their dependencies\nincludes as wheels (zip files with Python code), searching for the word\n`my_class` in `app.tgz`:\n\n    ug --zmax=2 -z -tPython -w my_class app.tgz\n\nTo recursively search C++ files including compressed files for the word\n`my_function`, while skipping C and C++ comments:\n\n    ug -z -r -tc++ -Fw my_function -f cpp/zap_comments\n\nTo search bzip2, lzma, xz, lz4 and zstd compressed data on standard input,\noption `--label` may be used to specify the extension corresponding to the\ncompression format to force decompression when the bzip2 extension is not\navailable to ugrep, for example:\n\n    cat myfile.bz2 | ugrep -z --label='stdin.bz2' 'xyz'\n\nTo search file `main.cpp` in `project.zip` for `TODO` and `FIXME` lines:\n\n    ug -z -g main.cpp -w -e 'TODO' -e 'FIXME' project.zip\n\nTo search tarball `project.tar.gz` for C++ files with `TODO` and `FIXME` lines:\n\n    ug -z -tc++ -w -e 'TODO' -e 'FIXME' project.tar.gz\n\nTo search files matching the glob `*.txt` in `project.zip` for the word\n`license` in any case (note that the `-g` glob argument must be quoted):\n\n    ug -z -g '*.txt' -w -i 'license' project.zip\n\nTo display and page through all C++ files in tarball `project.tgz`:\n\n    ug --pager -z -tc++ '' project.tgz\n\nTo list the files matching the gitignore-style glob `/**/projects/project1.*`\nin `projects.tgz`, by selecting files containing in the archive the text\n`December 12`:\n\n    ug -z -l -g '/**/projects/project1.*' -F 'December 12' projects.tgz\n\nTo view the META-INF/MANIFEST.MF data in a jar file with `-Ojar` and `-OMF` to\nselect the jar file and the MF file therein (`-Ojar` is required, otherwise the\njar file will be skipped though we could read it from standard input instead):\n\n    ug -z -h -OMF,jar '' my.jar\n\nTo extract C++ files that contain `FIXME` from `project.tgz`, we use `-m1`\nwith `--format=\"'%z '\"` to generate a space-separated list of pathnames of file\nlocated in the archive that match the word `FIXME`:\n\n    tar xzf project.tgz `ugrep -z -l -tc++ --format='%z ' -w FIXME project.tgz`\n\nTo perform a depth-first search with `find`, then use `cpio` and `ugrep` to\nsearch the files:\n\n    find . -depth -print | cpio -o | ugrep -z 'xyz'\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"magic\"/\u003e\n\n### Find files by file signature and shebang \"magic bytes\" with -M, -O and -t\n\n    --ignore-files[=FILE]\n            Ignore files and directories matching the globs in each FILE that\n            is encountered in recursive searches.  The default FILE is\n            `.gitignore'.  Matching files and directories located in the\n            directory of the FILE and in subdirectories below are ignored.\n            Globbing syntax is the same as the --exclude-from=FILE gitignore\n            syntax, but files and directories are excluded instead of only\n            files.  Directories are specifically excluded when the glob ends in\n            a `/'.  Files and directories explicitly specified as command line\n            arguments are never ignored.  This option may be repeated to\n            specify additional files.\n    -M MAGIC, --file-magic=MAGIC\n            Only files matching the signature pattern MAGIC are searched.  The\n            signature \\\"magic bytes\\\" at the start of a file are compared to\n            the MAGIC regex pattern.  When matching, the file will be searched.\n            When MAGIC is preceded by a `!' or a `^', skip files with matching\n            MAGIC signatures.  This option may be repeated and may be combined\n            with options -O and -t to expand the search.  Every file on the\n            search path is read, making searches potentially more expensive.\n    -O EXTENSIONS, --file-extension=EXTENSIONS\n            Search only files whose filename extensions match the specified\n            comma-separated list of EXTENSIONS, same as --include='*.ext' for\n            each `ext' in EXTENSIONS.  When `ext' is preceded by a `!' or a\n            `^', skip files whose filename extensions matches `ext', same as\n            --exclude='*.ext'.  This option may be repeated and may be combined\n            with options -g, -M and -t to expand the recursive search.\n    -t TYPES, --file-type=TYPES\n            Search only files associated with TYPES, a comma-separated list of\n            file types.  Each file type corresponds to a set of filename\n            extensions passed to option -O and filenames passed to option -g.\n            For capitalized file types, the search is expanded to include files\n            with matching file signature magic bytes, as if passed to option\n            -M.  When a type is preceded by a `!' or a `^', excludes files of\n            the specified type.  This option may be repeated.\n    -g GLOBS, --glob=GLOBS\n            Search only files whose name matches the specified comma-separated\n            list of GLOBS, same as --include='glob' for each `glob' in GLOBS.\n            When a `glob' is preceded by a `!' or a `^', skip files whose name\n            matches `glob', same as --exclude='glob'.  When `glob' contains a\n            `/', full pathnames are matched.  Otherwise basenames are matched.\n            When `glob' ends with a `/', directories are matched, same as\n            --include-dir='glob' and --exclude-dir='glob'.  A leading `/'\n            matches the working directory.  This option may be repeated and may\n            be combined with options -M, -O and -t to expand searches.  See\n            `ugrep --help globs' and `man ugrep' section GLOBBING for details.\n    --stats\n            Output statistics on the number of files and directories searched,\n            and the inclusion and exclusion constraints applied.\n\nTo recursively list all files that start with `#!` shebangs:\n\n    ug -l -M'#!' ''\n\nTo recursively list all files that start with `#` but not with `#!` shebangs:\n\n    ug -l -M'#' -M'^#!' ''\n\nTo recursively list all Python files (extension `.py` or a shebang) with\n`-tPython`:\n\n    ug -l -tPython ''\n\nTo recursively list all non-shell files with `-t^Shell`:\n\n    ug -l -t^Shell ''\n\nTo recursively list Python files (extension `.py` or a shebang) that have\nimport statements, including hidden files with `-.`:\n\n    ug -l. -tPython -f python/imports\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"fuzzy\"/\u003e\n\n### Fuzzy search with -Z\n\n    -Z[best][+-~][MAX], --fuzzy=[best][+-~][MAX]\n            Fuzzy mode: report approximate pattern matches within MAX errors.\n            The default is -Z1: one deletion, insertion or substitution is\n            allowed.  If `+`, `-' and/or `~' is specified, then `+' allows\n            insertions, `-' allows deletions and `~' allows substitutions.  For\n            example, -Z+~3 allows up to three insertions or substitutions, but\n            no deletions.  If `best' is specified, then only the best matching\n            lines are output with the lowest cost per file.  Option -Zbest\n            requires two passes over a file and cannot be used with standard\n            input or Boolean queries.  Option --sort=best orders matching files\n            by best match.  The first character of an approximate match always\n            matches a character at the beginning of the pattern.  To fuzzy\n            match the first character, replace it with a `.' or `.?'.  Option\n            -U applies fuzzy matching to ASCII and bytes instead of Unicode\n            text.  No whitespace may be given between -Z and its argument.\n\nThe beginning of a pattern always matches the first character of an approximate\nmatch as a practical strategy to prevent many false \"randomized\" matches for\nshort patterns.  This also greatly improves search speed.  Make the first\ncharacter optional to optionally match it, e.g. `p?attern` or use a dot as\nthe start of the pattern to match any wide character (but this is slow).\n\nLine feed (`\\n`) and NUL (`\\0`) characters are never deleted or substituted to\nensure that fuzzy matches do not extend the pattern match beyond the number of\nlines specified by the regex pattern.\n\nOption `-U` (`--ascii` or `--binary`) restricts fuzzy matches to ASCII and\nbinary only with edit distances measured in bytes.  Otherwise, fuzzy pattern\nmatching is performed with Unicode patterns and edit distances are measured in\nUnicode characters.\n\nOption `--sort=best` orders files by best match.  Files with at least one exact\nmatch anywhere in the file are shown first, followed by files with approximate\nmatches in increasing minimal edit distance order.  That is, ordered by the\nminimum error (edit distance) found among all approximate matches per file.\n\nTo recursively search for approximate matches of the word `foobar` with `-Z`,\ni.e.  approximate matching with one error, e.g. `Foobar`, `foo_bar`, `foo bar`,\n`fobar` and other forms with one missing, one extra or one deleted character:\n\n    ug -Z 'foobar'\n\nSame, but matching words only with `-w` and ignoring case with `-i`:\n\n    ug -Z -wi 'foobar'\n\nSame, but permit up to 2 insertions with `-Z+2`, no deletions/substitutions\n(matches up to 2 extra characters, such as `foos bar`), insertions-only offers\nthe fastest fuzzy matching method:\n\n    ug -Z+3 -wi 'foobar'\n\nSame, but sort matches from best (at least one exact match or fewest fuzzy\nmatch errors) to worst:\n\n    ug -Z+3 -wi --sort=best 'foobar'\n\n**Note:** because sorting by best match requires two passes over the input\nfiles, the efficiency of concurrent searching is significantly reduced.\n\nSame, but with customized formatting to show the edit distance \"cost\" of the\napproximate matches with format field `%Z` and `%F` to show the pathname:\n\n    ug -Z+3 -wi --format='%F%Z:%O%~' --sort=best 'foobar'\n\nSame, but this time count the matches with option `-c` and display them with a\ncustom format using `%m`, where `%Z` is the *average* cost per match:\n\n    ug -c -Z+3 -wi --format='%F%Z:%m%~' --sort=best 'foobar'\n\n**Note:** options `-c` and `-l` do not report a meaningful `%Z` value in the\n`--format` output, because `%Z` is the edit distance cost of a single match.\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"hidden\"/\u003e\n\n### Search hidden files with -.\n\n    --hidden, -.\n            Search hidden files and directories.\n\nTo recursively search the working directory, including hidden files and\ndirectories, for the word `login` in shell scripts:\n\n    ug -. -tShell 'login'\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"filter\"/\u003e\n\n### Using filter utilities to search documents with --filter\n\n    --filter=COMMANDS\n            Filter files through the specified COMMANDS first before searching.\n            COMMANDS is a comma-separated list of `exts:command [option ...]',\n            where `exts' is a comma-separated list of filename extensions and\n            `command' is a filter utility.  Files matching one of `exts' are\n            filtered.  When `exts' is a `*', all files are filtered.  One or\n            more `option' separated by spacing may be specified, which are\n            passed verbatim to the command.  A `%' as `option' expands into the\n            pathname to search.  For example, --filter='pdf:pdftotext % -'\n            searches PDF files.  The `%' expands into a `-' when searching\n            standard input.  When a `%' is not specified, a filter utility\n            should read from standard input and write to standard output.\n            Option --label=.ext may be used to specify extension `ext' when\n            searching standard input.  This option may be repeated.\n    --filter-magic-label=LABEL:MAGIC\n            Associate LABEL with files whose signature \"magic bytes\" match the\n            MAGIC regex pattern.  Only files that have no filename extension\n            are labeled, unless +LABEL is specified.  When LABEL matches an\n            extension specified in --filter=COMMANDS, the corresponding command\n            is invoked.  This option may be repeated.\n\nThe `--filter` option associates one or more filter utilities with specific\nfilename extensions.  A filter utility is selected based on the filename\nextension and executed by forking a process:  the utility's standard input\nreads the open input file and the utility's standard output is searched.  When\na `%` is specified as an option to the utility, the `%` is expanded to the\npathname of the file to open and read by the utility.\n\nWhen a specified utility is not found on the system, an error message is\ndisplayed.  When a utility fails to produce output, e.g. when the specified\noptions for the utility are invalid, the search is silently skipped.\n\nFiltering does not apply to files stored in archives and compressed files.  A\nfilter is usually applied to a file that is physically stored in the file\nsystem.  Archived files are not physically stored.\n\nCommon filter utilities are `cat` (concat, pass through), `head` (select first\nlines or bytes) `tr` (translate), `iconv` and `uconv` (convert), and more\nadvanced utilities, such as:\n\n- [`pdftotext`](https://pypi.org/project/pdftotext) to convert pdf to text\n- [`antiword`](https://github.com/rsdoiel/antiword) to convert doc to text\n- [`pandoc`](https://pandoc.org) to convert .docx, .epub, and other document\n  formats\n- [`exiftool`](https://exiftool.sourceforge.net) to read meta information\n  embedded in image and video media formats.\n- [`soffice`](https://www.libreoffice.org) to convert office documents\n- [`csvkit`](https://pypi.org/project/csvkit) to convert spreadsheets\n- [`openssl`](https://wiki.openssl.org/index.php/Command_Line_Utilities) to\n  convert certificates and key files to text and other formats\n\nThe `ugrep+` and `ug+` commands use the `pdftotext`, `antiword`, `pandoc` and\n`exiftool` filters, when installed, to search pdfs, documents, e-books, and\nimage metadata.\n\nAlso decompressors may be used as filter utilities, such as `unzip`, `gunzip`,\n`bunzip2`, `unlzma`, `unxz`, `lzop` and `7z` that decompress files to standard\noutput when option `--stdout` is specified.  For example:\n\n    ug --filter='lzo:lzop -d --stdout -' ...\n    ug --filter='gz:gunzip -d --stdout -' ...\n    ug --filter='7z:7z x -so %' ...\n\nThe `--filter='lzo:lzop -d --stdout -'` option decompresses files with\nextension `lzo` to standard output with `--stdout` with the compressed stream\nbeing read from standard input with `-`.  The `--filter='7z:7z x -so -si`\noption decompresses files with extension `7z` to standard output `-so` while\nreading standard input `-si` with the compressed file contents.\n\nNote that **ugrep** option `-z` is typically faster to search compressed files\ncompared to `--filter`.\n\nThe `--filter` option may also be used to run a user-defined shell script to\nfilter files.  For example, to invoke an action depending on the filename\nextension of the `%` argument.  Another use case is to pass a file to more than\none filter, which can be accomplished with a shell script containing the line\n`tool1 $1; tool2 $1`.  This filters the file argument `$1` with `tool1`\nfollowed by `tool2` to produce combined output to search for pattern matches.\nLikewise, we can use a script with the line `tool1 $1 | tool2` to stack two\nfilters `tool1` and `tool2`.\n\nThe `--filter` option may also be used as a predicate to skip certain files\nfrom the search.  As the most basic example, consider the `false` utility that\nexits with a nonzero exit code without reading input or producing output.\nTherefore, `--filter='swp: false'` skips all `.swp` files from recursive\nsearches.  The same can be done more efficiently with `-O^swp`.  However,\nthe `--filter` option could invoke a script that determines if the filename\npassed as a `%` argument meets certain constraints.  If the constraint is met\nthe script copies standard input to standard output with `cat`.  If not, the\nscript exits.\n\n**Warning:** option `--filter` should not be used with utilities that modify\nfiles.  Otherwise searches may be unpredicatable.  In the worst case files may\nbe lost, for example when the specified utility replaces or deletes the file\npassed to the command with `--filter` option `%`.\n\nTo recursively search files including PDF files in the working directory\nwithout recursing into subdirectories (with `-1`), for matches of `drink me`\nusing the `pdftotext` filter to convert PDF to text without preserving page\nbreaks:\n\n    ug -r -1 --filter='pdf:pdftotext -nopgbrk % -' 'drink me'\n\nTo recursively search text files for `eat me` while converting non-printable\ncharacters in .txt and .md files using the `cat -v` filter:\n\n    ug -r -ttext --filter='txt,md:cat -v' 'eat me'\n\nThe same, but specifying the .txt and .md filters separately:\n\n    ug -r -ttext --filter='txt:cat -v, md:cat -v' 'eat me'\n\nTo search the first 8K of a text file:\n\n    ug --filter='txt:head -c 8192' 'eat me' wonderland.txt\n\nTo recursively search and list the files that contain the word `Alice`,\nincluding .docx and .epub documents using the `pandoc` filter:\n\n    ug -rl -w --filter='docx,epub:pandoc --wrap=preserve -t plain % -o -' 'Alice'\n\n**Important:** the `pandoc` utility requires an input file and will not read\nstandard input.  Option `%` expands into the full pathname of the file to\nsearch.  The output format specified is `markdown`, which is close enough to\ntext to be searched.\n\nTo recursively search and list the files that contain the word `Alice`,\nincluding .odt, .doc, .docx, .rtf, .xls, .xlsx, .ppt, .pptx documents using the\n`soffice` filter:\n\n    ug -rl -w --filter='odt,doc,docx,rtf,xls,xlsx,ppt,pptx:soffice --headless --cat %' 'Alice'\n\n**Important:** the `soffice` utility will not output any text when one or more\nLibreOffice GUIs are open.  Make sure to quit all LibreOffice apps first.  This\nlooks like a bug, but the LibreOffice developers do not appear to fix this\nany time soon (unless perhaps more people complain?). You can work around this\nproblem by specifying a specific user profile for `soffice` with the following\nsemi-documented argument passed to `soffice`:\n`-env:UserInstallation=file:///home/user/.libreoffice-alt`.\n\nTo recursively search and display rows of .csv, .xls, and .xlsx spreadsheets\nthat contain `10/6` using the `in2csv` filter of csvkit:\n\n    ug -r -Ocsv,xls,xlsx --filter='xls,xlsx:in2csv %' '10/6'\n\nTo search .docx, .xlsx, and .pptx files converted to XML for a match with\n`10/6` using `unzip` as a filter:\n\n    ug -lr -Odocx,xlsx,pptx --filter='docx,xlsx,pptx:unzip -p %' '10/6'\n\n**Important:** unzipping docx, xlxs, pptx files produces extensive XML output\ncontaining meta information and binary data such as images.  By contrast,\n**ugrep** option `-z` with `-Oxml` selects the XML components only:\n\n    ug -z -lr -Odocx,xlsx,pptx,xml '10/6'\n\n**Note:** docx, xlsx, and pptx are zip files containing multiple components.\nWhen selecting the XML components with option `-Oxml` in docx, xlsx, and pptx\ndocuments, we should also specify `-Odocx,xlsx,pptx` to search these type of\nfiles, otherwise these files will be ignored.\n\nTo recurssively search X509 certificate files for lines with `Not After` (e.g.\nto find expired certificates), using `openssl` as a filter:\n\n    ug -r 'Not After' -Ocer,der,pem --filter='pem:openssl x509 -text,cer,crt,der:openssl x509 -text -inform der'\n\nNote that `openssl` warning messages are displayed on standard error.  If\na file cannot be converted it is probably in a different format.  This can\nbe resolved by writing a shell script that executes `openssl` with options\nbased on the file content.  Then write a script with `ugrep --filter`.\n\nTo search PNG files by filename extension with `-tpng` using `exiftool`:\n\n    ug -r -i 'copyright' -tpng --filter='*:exiftool %'\n\nSame, but also include files matching PNG \"magic bytes\" with `-tPng` and\n`--filter-magic-label='+png:\\x89png\\x0d\\x0a\\x1a\\x0a'` to select the `png`\nfilter:\n\n    ug -r -i 'copyright' -tPng --filter='png:exiftool %' --filter-magic-label='+png:\\x89png\\x0d\\x0a\\x1a\\x0a'\n\nNote that `+png` overrides any filename extension match for `--filter`.\nOtherwise, without a `+`, the filename extension, when present, takes priority\nover labelled magic patterns to invoke the corresponding filter command.\nThe `LABEL` used with `--filter-magic-label` and `--filter` has no specific\nmeaning; any name or string that does not contain a `:` or `,` may be used.\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"binary\"/\u003e\n\n### Searching and displaying binary files with -U, -W, and -X\n\n    --hexdump[=[1-8][a][bch][A[NUM]][B[NUM]][C[NUM]]]\n            Output matches in 1 to 8 columns of 8 hexadecimal octets.  The\n            default is 2 columns or 16 octets per line.  Argument `a' outputs a\n            `*' for all hex lines that are identical to the previous hex line,\n            `b' removes all space breaks, `c' removes the character column, `h'\n            removes hex spacing, `A' includes up to NUM hex lines after a\n            match, `B' includes up to NUM hex lines before a match and `C'\n            includes up to NUM hex lines before and after a match.  Arguments\n            `A', `B' and `C' are the same as options -A, -B and -C when used\n            with --hexdump.  See also options -U, -W and -X.\n    -U, --ascii, --binary\n            Disables Unicode matching for binary file matching, forcing PATTERN\n            to match bytes, not Unicode characters.  For example, -U '\\xa3'\n            matches byte A3 (hex) instead of the Unicode code point U+00A3\n            represented by the UTF-8 sequence C2 A3.  See also --dotall.\n    -W, --with-hex\n            Output binary matches in hexadecimal, leaving text matches alone.\n            This option is equivalent to the --binary-files=with-hex option.\n            To omit the matching line from the hex output, use both options -W\n            and --hexdump.  See also options -U.\n    -X, --hex\n            Output matches and matching lines in hexadecimal.  This option is\n            equivalent to the --binary-files=hex option.  To omit the matching\n            line from the hex output use option --hexdump.  See also option -U.\n    --dotall\n            Dot `.' in regular expressions matches anything, including newline.\n            Note that `.*' matches all input and should not be used.\n\nNote that `--hexdump` differs from `-X` by omitting the matching line from the\nhex output, showing only the matching pattern using a minimal number of hex\nlines.  Additional match context hex lines are output with the `-ABC` context\noptions or with `--hexdump=C3` to output 3 hex lines as context, for example.\n\nTo search a file for ASCII words, displaying text lines as usual while binary\ncontent is shown in hex with `-U` and `-W`:\n\n    ug -UW '\\w+' myfile\n\nTo hexdump an entire file as a match with `-X`:\n\n    ug -X '' myfile\n\nTo hexdump an entire file with `-X`, displaying line numbers and byte offsets\nwith `-nb` (here with `-y` to display all line numbers):\n\n    ug -Xynb '' myfile\n\nTo hexdump lines containing one or more \\0 in a (binary) file using a\nnon-Unicode pattern with `-U` and `-X`:\n\n    ug -UX '\\x00+' myfile\n\nSame, but hexdump the entire file as context with `-y` (note that this\nline-based option does not permit matching patterns with newlines):\n\n    ug -UX -y '\\x00+' myfile\n\nSame, compacted to 32 bytes per line without the character column:\n\n    ug -UX -y '\\x00+' myfile\n\nTo match the binary pattern `A3..A3.` (hex) in a binary file without\nUnicode pattern matching (which would otherwise match `\\xaf` as a Unicode\ncharacter U+00A3 with UTF-8 byte sequence C2 A3) and display the results\nin compact hex with `--hexdump` with pager:\n\n    ug --pager --hexdump -U '\\xa3[\\x00-\\xff]{2}\\xa3[\\x00-\\xff]' a.out\n\nSame, but using option `--dotall` to let `.` match any byte, including\nnewline that is not matched by dot (the default as required by grep):\n\n    ug --dotall --pager --hexdump -U '\\xa3.{2}\\xa3.' a.out\n\nTo list all files containing a RPM signature, located in the `rpm` directory and\nrecursively below (see for example\n[list of file signatures](https://en.wikipedia.org/wiki/List_of_file_signatures)):\n\n    ug -RlU '\\A\\xed\\xab\\xee\\xdb' rpm\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"nobinary\"/\u003e\n\n### Ignore binary files with -I\n\n    -I      Ignore matches in binary files.  This option is equivalent to the\n            --binary-files=without-match option.\n\nTo recursively search without following symlinks and ignoring binary files:\n\n    ug -rl -I 'xyz'\n\nTo ignore specific binary files with extensions such as .exe, .bin, .out, .a,\nuse `--exclude` or `--exclude-from`:\n\n    ug -rl --exclude-from=ignore_binaries 'xyz'\n\nwhere `ignore_binaries` is a file containing a glob on each line to ignore\nmatching files, e.g.  `*.exe`, `*.bin`, `*.out`, `*.a`.  Because the command is\nquite long to type, an alias for this is recommended, for example `ugs` (ugrep\nsource):\n\n    alias ugs=\"ugrep --exclude-from=~/ignore_binaries\"\n    ugs -rl 'xyz'\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"ignore\"/\u003e\n\n### Ignoring .gitignore-specified files with --ignore-files\n\n    --ignore-files[=FILE]\n            Ignore files and directories matching the globs in each FILE that\n            is encountered in recursive searches.  The default FILE is\n            `.gitignore'.  Matching files and directories located in the\n            directory of the FILE and in subdirectories below are ignored.\n            Globbing syntax is the same as the --exclude-from=FILE gitignore\n            syntax, but files and directories are excluded instead of only\n            files.  Directories are specifically excluded when the glob ends in\n            a `/'.  Files and directories explicitly specified as command line\n            arguments are never ignored.  This option may be repeated to\n            specify additional files.\n\nOption `--ignore-files` looks for `.gitignore`, or the specified `FILE`, in\nrecursive searches.  When `.gitignore`, or the specified `FILE`, is found while\ntraversing directory tree branches down, the `.gitignore` file is used to\ntemporarily extend the previous exclusions with the additional globs in\n`.gitignore` to apply the combined exclusions to the directory tree rooted at\nthe `.gitignore` location.  Use `--stats` to show the selection criteria\napplied to the search results and the locations of each `FILE` found.  To avoid\nconfusion, files and directories specified as command-line arguments to\n**ugrep** are never ignored.\n\nNote that exclude glob patterns take priority over include glob patterns when\nspecified with command line options.  By contrast, negated glob patterns\nspecified with `!` in `--ignore-files` files take priority.  This effectively\noverrides the exclusions and resolves conflicts in favor of listing matching\nfiles that are explicitly specified as exceptions and should be included in the\nsearch.\n\nSee also [Using gitignore-style globs to select directories and files to search](#globs).\n\nTo recursively search without following symlinks, while ignoring files and\ndirectories ignored by .gitignore (when present), use option `--ignore-files`.\nNote that `-r` is the default when no FILE arguments are specified, we use it\nhere to make the examples easier to follow.\n\n    ug -rl --ignore-files 'xyz'\n\nSame, but includes hidden files with `-.` rather than ignoring them:\n\n    ug -rl. --ignore-files 'xyz'\n\nTo recursively list all files that are not ignored by .gitignore (when present)\nwith `--ignore-files`:\n\n    ug -rl --ignore-files ''\n\nSame, but list shell scripts that are not ignored by .gitignore, when present:\n\n    ug -rl -tShell '' --ignore-files\n\nTo recursively list all files that are not ignored by .gitignore and are also\nnot excluded by `.git/info/exclude`:\n\n    ug -rl '' --ignore-files --exclude-from=.git/info/exclude\n\nSame, but by creating a symlink to `.git/info/exclude` to make the exclusions\nimplicit:\n\n    ln -s .git/info/exclude .ignore\n    ug -rl '' --ignore-files --ignore-files=.ignore\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"globs\"/\u003e\n\n### Using gitignore-style globs to select directories and files to search\n\n    -g GLOBS, --glob=GLOBS\n            Search only files whose name matches the specified comma-separated\n            list of GLOBS, same as --include='glob' for each `glob' in GLOBS.\n            When a `glob' is preceded by a `!' or a `^', skip files whose name\n            matches `glob', same as --exclude='glob'.  When `glob' contains a\n            `/', full pathnames are matched.  Otherwise basenames are matched.\n            When `glob' ends with a `/', directories are matched, same as\n            --include-dir='glob' and --exclude-dir='glob'.  A leading `/'\n            matches the working directory.  This option may be repeated and may\n            be combined with options -M, -O and -t to expand searches.  See\n            `ugrep --help globs' and `man ugrep' section GLOBBING for details.\n    --exclude=GLOB\n            Skip files whose name matches GLOB using wildcard matching, same as\n            -g ^GLOB.  GLOB can use **, *, ?, and [...] as wildcards, and \\\\ to\n            quote a wildcard or backslash character literally.  When GLOB\n            contains a `/', full pathnames are matched.  Otherwise basenames\n            are matched.  When GLOB ends with a `/', directories are excluded\n            as if --exclude-dir is specified.  Otherwise files are excluded.\n            Note that --exclude patterns take priority over --include patterns.\n            GLOB should be quoted to prevent shell globbing.  This option may\n            be repeated.\n    --exclude-dir=GLOB\n            Exclude directories whose name matches GLOB from recursive\n            searches, same as -g ^GLOB/.  GLOB can use **, *, ?, and [...] as\n            wildcards, and \\\\ to quote a wildcard or backslash character\n            literally.  When GLOB contains a `/', full pathnames are matched.\n            Otherwise basenames are matched.  Note that --exclude-dir patterns\n            take priority over --include-dir patterns.  GLOB should be quoted\n            to prevent shell globbing.  This option may be repeated.\n    --exclude-from=FILE\n            Read the globs from FILE and skip files and directories whose name\n            matches one or more globs.  A glob can use **, *, ?, and [...] as\n            wildcards, and \\ to quote a wildcard or backslash character\n            literally.  When a glob contains a `/', full pathnames are matched.\n            Otherwise basenames are matched.  When a glob ends with a `/',\n            directories are excluded as if --exclude-dir is specified.\n            Otherwise files are excluded.  A glob starting with a `!' overrides\n            previously-specified exclusions by including matching files.  Lines\n            starting with a `#' and empty lines in FILE are ignored.  When FILE\n            is a `-', standard input is read.  This option may be repeated.\n    --ignore-files[=FILE]\n            Ignore files and directories matching the globs in each FILE that\n            is encountered in recursive searches.  The default FILE is\n            `.gitignore'.  Matching files and directories located in the\n            directory of the FILE and in subdirectories below are ignored.\n            Globbing syntax is the same as the --exclude-from=FILE gitignore\n            syntax, but files and directories are excluded instead of only\n            files.  Directories are specifically excluded when the glob ends in\n            a `/'.  Files and directories explicitly specified as command line\n            arguments are never ignored.  This option may be repeated to\n            specify additional files.\n    --include=GLOB\n            Search only files whose name matches GLOB using wildcard matching,\n            same as -g GLOB.  GLOB can use **, *, ?, and [...] as wildcards,\n            and \\\\ to quote a wildcard or backslash character literally.  When\n            GLOB contains a `/', full pathnames are matched.  Otherwise\n            basenames are matched.  When GLOB ends with a `/', directories are\n            included as if --include-dir is specified.  Otherwise files are\n            included.  Note that --exclude patterns take priority over\n            --include patterns.  GLOB should be quoted to prevent shell\n            globbing.  This option may be repeated.\n    --include-dir=GLOB\n            Only directories whose name matches GLOB are included in recursive\n            searches, same as -g GLOB/.  GLOB can use **, *, ?, and [...] as\n            wildcards, and \\\\ to quote a wildcard or backslash character\n            literally.  When GLOB contains a `/', full pathnames are matched.\n            Otherwise basenames are matched.  Note that --exclude-dir patterns\n            take priority over --include-dir patterns.  GLOB should be quoted\n            to prevent shell globbing.  This option may be repeated.\n    --include-from=FILE\n            Read the globs from FILE and search only files and directories\n            whose name matches one or more globs.  A glob can use **, *, ?, and\n            [...] as wildcards, and \\ to quote a wildcard or backslash\n            character literally.  When a glob contains a `/', full pathnames\n            are matched.  Otherwise basenames are matched.  When a glob ends\n            with a `/', directories are included as if --include-dir is\n            specified.  Otherwise files are included.  A glob starting with a\n            `!' overrides previously-specified inclusions by excluding matching\n            files.  Lines starting with a `#' and empty lines in FILE are\n            ignored.  When FILE is a `-', standard input is read.  This option\n            may be repeated.\n    -O EXTENSIONS, --file-extension=EXTENSIONS\n            Search only files whose filename extensions match the specified\n            comma-separated list of EXTENSIONS, same as --include='*.ext' for\n            each `ext' in EXTENSIONS.  When `ext' is preceded by a `!' or a\n            `^', skip files whose filename extensions matches `ext', same as\n            --exclude='*.ext'.  This option may be repeated and may be combined\n            with options -g, -M and -t to expand the recursive search.\n    --stats\n            Output statistics on the number of files and directories searched,\n            and the inclusion and exclusion constraints applied.\n\nSee also [Including or excluding mounted file systems from searches](#fs).\n\nGitignore-style glob syntax and conventions:\n\npattern    | matches\n---------- | ------------------------------------------------------------------\n`*`        | anything except `/`\n`?`        | any one character except `/`\n`[abc-e]`  | one character `a`,`b`,`c`,`d`,`e`\n`[^abc-e]` | one character not `a`,`b`,`c`,`d`,`e`,`/`\n`[!abc-e]` | one character not `a`,`b`,`c`,`d`,`e`,`/`\n`/`        | when used at the start of a glob, matches working directory\n`**/`      | zero or more directories\n`/**`      | when at the end of a glob, matches everything after the `/`\n`\\?`       | a `?` or any other character specified after the backslash\n\nWhen a glob pattern contains a path separator `/`, the full pathname is\nmatched.  Otherwise the basename of a file or directory is matched in recursive\nsearches.  For example, `*.h` matches `foo.h` and `bar/foo.h`. `bar/*.h`\nmatches `bar/foo.h` but not `foo.h` and not `bar/bar/foo.h`.\n\nWhen a glob pattern begins with a `/`, files and directories are matched at the\nworking directory, not recursively.  For example, use a leading `/` to force\n`/*.h` to match `foo.h` but not `bar/foo.h`.\n\nWhen a glob pattern ends with a `/`, directories are matched instead of files,\nsame as `--include-dir`.\n\nWhen a glob starts with a `!` as specified with `-g!GLOB`, or specified in a\n`FILE` with `--include-from=FILE` or `--exclude-from=FILE`, it is negated.\n\nTo view a list of inclusions and exclusions that were applied to a search, use\noption `--stats`.\n\nTo list only readable files with names starting with `foo` in the working\ndirectory, that contain `xyz`, without producing warning messages with `-s` and\n`-l`:\n\n    ug -sl 'xyz' foo*\n\nThe same, but using deep recursion with inclusion constraints (note that\n`-g'/foo*` is the same as `--include='/foo*'` and `-g'/foo*/'` is the same as\n`--include-dir='/foo*'`, i.e.  immediate subdirectories matching `/foo*` only):\n\n    ug -rl 'xyz' -g'/foo*' -g'/foo*/'\n\nNote that `-r` is the default, we use it here to make the examples easier to\nfollow.\n\nTo exclude directory `bak` located in the working directory:\n\n    ug -rl 'xyz' -g'^/bak/'\n\nTo exclude all directoies `bak` at any directory level deep:\n\n    ug -rl 'xyz' -g'^bak/'\n\nTo only list files in the working directory and its subdirectory `doc`,\nthat contain `xyz` (note that `-g'/doc/'` is the same as\n`--include-dir='/doc'`, i.e. immediate subdirectory `doc` only):\n\n    ug -rl 'xyz' -g'/doc/'\n\nTo only list files that are on a subdirectory path `doc` that includes\nsubdirectory `html` anywhere, that contain `xyz`:\n\n    ug -rl 'xyz' -g'doc/**/html/'\n\nTo only list files in the working directory and in the subdirectories `doc`\nand `doc/latest` but not below, that contain `xyz`:\n\n    ug -rl 'xyz' -g'/doc/' -g'/doc/latest/'\n\nTo recursively list .cpp files in the working directory and any subdirectory\nat any depth, that contain `xyz`:\n\n    ug -rl 'xyz' -g'*.cpp'\n\nThe same, but using a .gitignore-style glob that matches pathnames (globs with\n`/`) instead of matching basenames (globs without `/`) in the recursive search:\n\n    ug -rl 'xyz' -g'**/*.cpp'\n\nSame, but using option `-Ocpp` to match file name extensions:\n\n    ug -rl -Ocpp 'xyz'\n\nTo recursively list all files in the working directory and below that are not\nignored by a specific .gitignore file:\n\n    ug -rl '' --exclude-from=.gitignore\n\nTo recursively list all files in the working directory and below that are not\nignored by one or more .gitignore files, when any are present:\n\n    ug -rl '' --ignore-files\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"fs\"/\u003e\n\n### Including or excluding mounted file systems from searches\n\n    --exclude-fs=MOUNTS\n            Exclude file systems specified by MOUNTS from recursive searches.\n            MOUNTS is a comma-separated list of mount points or pathnames to\n            directories.  When MOUNTS is not specified, only descends into the\n            file systems associated with the specified file and directory\n            search targets, i.e. excludes all other file systems.  Note that\n            --exclude-fs=MOUNTS take priority over --include-fs=MOUNTS.  This\n            option may be repeated.\n    --include-fs=MOUNTS\n            Only file systems specified by MOUNTS are included in recursive\n            searches.  MOUNTS is a comma-separated list of mount points or\n            pathnames to directories.  When MOUNTS is not specified, restricts\n            recursive searches to the file system of the working directory,\n            same as --include-fs=. (dot). Note that --exclude-fs=MOUNTS take\n            priority over --include-fs=MOUNTS.  This option may be repeated.\n\nThese options control recursive searches across file systems by comparing\ndevice numbers.  Mounted devices and symbolic links to files and directories\nlocated on mounted file systems may be included or excluded from recursive\nsearches by specifying a mount point or a pathname of any directory on the file\nsystem to specify the applicable file system.\n\nNote that a list of mounted file systems is typically stored in `/etc/mtab`.\n\nTo restrict recursive searches to the file system(s) of the search targets\nonly, without crossing into other file systems (similar to `find` option `-x`):\n\n    ug -rl --exclude-fs 'xyz' /sys /var\n\nTo restrict recursive searches to the file system of the working directory\nonly, without crossing into other file systems:\n\n    ug -l --include-fs 'xyz'\n\nIn fact, for this case we can use `--exclude-fs` because we search the working\ndirectory as the target and we want to exclude all other file systems:\n\n    ug -l --exclude-fs 'xyz'\n\nTo exclude the file systems mounted at `/dev` and `/proc` from recursive\nsearches:\n\n    ug -l --exclude-fs=/dev,/proc 'xyz'\n\nTo only include the file system associated with drive `d:` in recursive\nsearches:\n\n    ug -l --include-fs=d:/ 'xyz'\n\nTo exclude `fuse` and `tmpfs` type file systems from recursive searches:\n\n    exfs=`ugrep -w -e fuse -e tmpfs /etc/mtab | ugrep -P '^\\S+ (\\S+)' --format='%,%1'`\n    ug -l --exclude-fs=\"$exfs\" 'xyz'\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"count\"/\u003e\n\n### Counting the number of matches with -c and -co\n\n    -c, --count\n            Only a count of selected lines is written to standard output.\n            If -o or -u is specified, counts the number of patterns matched.\n            If -v is specified, counts the number of non-matching lines.  If\n            -m1, (with a comma or --min-count=1) is specified, counts only\n            matching files without outputting zero matches.\n\nTo count the number of lines in a file:\n\n    ug -c '' myfile.txt\n\nTo count the number of lines with `TODO`:\n\n    ug -c -w 'TODO' myfile.cpp\n\nTo count the total number of `TODO` in a file, use `-c` and `-o`:\n\n    ug -co -w 'TODO' myfile.cpp\n\nTo count the number of ASCII words in a file:\n\n    ug -co '[[:word:]]+' myfile.txt\n\nTo count the number of ASCII and Unicode words in a file:\n\n    ug -co '\\w+' myfile.txt\n\nTo count the number of Unicode characters in a file:\n\n    ug -co '\\p{Unicode}' myfile.txt\n\nTo count the number of zero bytes in a file:\n\n    ug -UX -co '\\x00' image.jpg\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"fields\"/\u003e\n\n### Displaying file, line, column, and byte offset info with -H, -n, -k, -b, and -T\n\n    -b, --byte-offset\n            The offset in bytes of a matched line is displayed in front of the\n            respective matched line.  When used with option -u, displays the\n            offset in bytes of each pattern matched.  Byte offsets are exact\n            for ASCII, UTF-8, and raw binary input.  Otherwise, the byte offset\n            in the UTF-8 converted input is displayed.\n    -H, --with-filename\n            Always print the filename with output lines.  This is the default\n            when there is more than one file to search.\n    -k, --column-number\n            The column number of a matched pattern is displayed in front of the\n            respective matched line, starting at column 1.  Tabs are expanded\n            when columns are counted, see option --tabs.\n    -n, --line-number\n            Each output line is preceded by its relative line number in the\n            file, starting at line 1.  The line number counter is reset for\n            each file processed.\n    -T, --initial-tab\n            Add a tab space to separate the file name, line number, column\n            number, and byte offset with the matched line.\n\nTo display the file name `-H`, line `-n`, and column `-k` numbers of matches in\n`myfile.cpp`, with spaces and tabs to space the columns apart with `-T`:\n\n    ug -THnk 'main' myfile.cpp\n\nTo display the line with `-n` of word `main` in `myfile.cpp`:\n\n    ug -nw 'main' myfile.cpp\n\nTo display the entire file `myfile.cpp` with line `-n` numbers:\n\n    ug -n '' myfile.cpp\n\nTo recursively search for C++ files with `main`, showing the line and column\nnumbers of matches with `-n` and `-k`:\n\n    ug -r -nk -tc++ 'main'\n\nTo display the byte offset of matches with `-b`:\n\n    ug -r -b -tc++ 'main'\n\nTo display the line and column numbers of matches in XML with `--xml`:\n\n    ug -r -nk --xml -tc++ 'main'\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"color\"/\u003e\n\n### Displaying colors with --color and paging the output with --pager\n\n    --color[=WHEN], --colour[=WHEN]\n            Mark up the matching text with the expression stored in the\n            GREP_COLOR or GREP_COLORS environment variable.  The possible\n            values of WHEN can be `never', `always', or `auto', where `auto'\n            marks up matches only when output on a terminal.  The default is\n            `auto'.\n    --colors=COLORS, --colours=COLORS\n            Use COLORS to mark up text.  COLORS is a colon-separated list of\n            one or more parameters `sl=' (selected line), `cx=' (context line),\n            `mt=' (matched text), `ms=' (match selected), `mc=' (match\n            context), `fn=' (file name), `ln=' (line number), `cn=' (column\n            number), `bn=' (byte offset), `se=' (separator), `qp=' (TUI\n            prompt), `qe=' (TUI errors), `qr=' (TUI regex), `qm=' (TUI regex\n            meta characters), `ql=' (TUI regex lists and literals), `qb=' (TUI\n            regex braces).  Parameter values are ANSI SGR color codes or `k'\n            (black), `r' (red), `g' (green), `y' (yellow), `b' (blue), `m'\n            (magenta), `c' (cyan), `w' (white), or leave empty for no color.\n            Upper case specifies background colors.  A `+' qualifies a color as\n            bright.  A foreground and a background color may be combined with\n            font properties `n' (normal), `f' (faint), `h' (highlight), `i'\n            (invert), `u' (underline).  Parameter `hl' enables file name\n            hyperlinks.  Parameter `rv' reverses the `sl=' and `cx=' parameters\n            when option -v is specified.  Selectively overrides GREP_COLORS.\n            Legacy grep single parameter codes may be specified, for example\n            --colors='7;32' or --colors=ig to set ms (match selected).\n    --tag[=TAG[,END]]\n            Disables colors to mark up matches with TAG.  END marks the end of\n            a match if specified, otherwise TAG.  The default is `___'.\n    --pager[=COMMAND]\n            When output is sent to the terminal, uses COMMAND to page through\n            the output.  COMMAND defaults to environment variable PAGER when\n            defined or `less'.  Enables --heading and --line-buffered.\n    --pretty[=WHEN]\n            When output is sent to a terminal, enables --color, --heading, -n,\n            --sort, --tree and -T when not explicitly disabled.  WHEN can be\n            `never', `always', or `auto'.  The default is `auto'.\n    --tree, -^\n            Output directories with matching files in a tree-like format for\n            option -c or --count, -l or --files-with-matches, -L or\n            --files-without-match.  This option is enabled by --pretty when the\n            output is sent to a terminal.\n\nTo change the color palette, set the `GREP_COLORS` environment variable or use\n`--colors=COLORS`.  The value is a colon-separated list of ANSI SGR parameters\nthat defaults to `cx=33:mt=1;31:fn=1;35:ln=1;32:cn=1;32:bn=1;32:se=36`:\n\nparam | result\n----- | ------------------------------------------------------------------------\n`sl=` | selected lines\n`cx=` | context lines\n`rv`  | Swaps the `sl=` and `cx=` capabilities when `-v` is specified\n`mt=` | matching text in any matching line\n`ms=` | matching text in a selected line.  The substring mt= by default\n`mc=` | matching text in a context line.  The substring mt= by default\n`fn=` | file names\n`ln=` | line numbers\n`cn=` | column numbers\n`bn=` | byte offsets\n`se=` | separators\n`hl`  | hyperlink file names, same as `--hyperlink`\n`qp=` | TUI prompt\n`qe=` | TUI errors\n`qr=` | TUI regex\n`qm=` | TUI regex meta characters\n`ql=` | TUI regex lists and literals\n`qb=` | TUI regex braces\n\nMultiple SGR codes may be specified for a single parameter when separated by a\nsemicolon, e.g. `mt=1;31` specifies bright red.  The following SGR codes are\navailable on most color terminals:\n\ncode | c | effect                     | code | c  | effect\n---- | - | -------------------------- | ---- | -- | ----------------------------\n0    | n | normal font and color      | 2    | f  | faint (not widely supported)\n1    | h | highlighted bold font      | 21   | H  | highlighted bold off\n4    | u | underline                  | 24   | U  | underline off\n7    | i | invert video               | 27   | I  | invert off\n30   | k | black text                 | 90   | +k | bright gray text\n31   | r | red text                   | 91   | +r | bright red text\n32   | g | green text                 | 92   | +g | bright green text\n33   | y | yellow text                | 93   | +y | bright yellow text\n34   | b | blue text                  | 94   | +b | bright blue text\n35   | m | magenta text               | 95   | +m | bright magenta text\n36   | c | cyan text                  | 96   | +c | bright cyan text\n37   | w | white text                 | 97   | +w | bright white text\n40   | K | black background           | 100  | +K | bright gray background\n41   | R | dark red background        | 101  | +R | bright red background\n42   | G | dark green background      | 102  | +G | bright green background\n43   | Y | dark yellow backgrounda    | 103  | +Y | bright yellow background\n44   | B | dark blue background       | 104  | +B | bright blue background\n45   | M | dark magenta background    | 105  | +M | bright magenta background\n46   | C | dark cyan background       | 106  | +C | bright cyan background\n47   | W | dark white background      | 107  | +W | bright white background\n\nSee Wikipedia [ANSI escape code - SGR parameters](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters)\n\nFor quick and easy color specification, the corresponding single-letter color\nnames may be used in place of numeric SGR codes and semicolons are not required\nto separate color names.  Color names and numeric codes may be mixed.\n\nFor example, to display matches in underlined bright green on bright selected\nlines, aiding in visualizing white space in matches and file names:\n\n    export GREP_COLORS='sl=1:cx=33:ms=1;4;32;100:mc=1;4;32:fn=1;32;100:ln=1;32:cn=1;32:bn=1;32:se=36'\n\nThe same, but with single-letter color names:\n\n    export GREP_COLORS='sl=h:cx=y:ms=hug+K:mc=hug:fn=hg+K:ln=hg:cn=hg:bn=hg:se=c'\n\nAnother color scheme that works well:\n\n    export GREP_COLORS='cx=hb:ms=hiy:mc=hic:fn=hi+y+K:ln=hg:cn=hg:bn=hg:se='\n\nModern Windows command interpreters support ANSI escape codes.  Named or\nnumeric colors can be set with `SET GREP_COLORS`, for example:\n\n    SET GREP_COLORS=sl=1;37:cx=33:mt=1;31:fn=1;35:ln=1;32:cn=1;32:bn=1;32:se=36\n\nTo disable colors on Windows:\n\n    SET GREP_COLORS=\"\"\n\nColor intensities may differ per platform and per terminal program used, which\naffects readability.\n\nOption `-y` outputs every line of input, including non-matching lines as\ncontext.  The use of color helps distinguish matches from non-matching context.\n\nTo copy silver searcher's color palette:\n\n    export GREP_COLORS='mt=30;43:fn=1;32:ln=1;33:cn=1;33:bn=1;33'\n\nTo produce color-highlighted results (`--color` is redundance since it is the\ndefault):\n\n    ug --color -r -n -k -tc++ 'FIXME.*'\n\nTo page through the results with pager (`less -R` by default):\n\n    ug --pager -r -n -k -tc++ 'FIXME'\n\nTo display a hexdump of a zip file itself (i.e. without decompressing), with\ncolor-highlighted matches of the zip magic bytes `PK\\x03\\x04` (`--color` is\nredundant since it is the default):\n\n    ug --color -y -UX 'PK\\x03\\x04' some.zip\n\nTo use predefined patterns to list all `#include` and `#define` in C++ files:\n\n    ug --pretty -r -n -tc++ -f c++/includes -f c++/defines\n\nSame, but overriding the color of matches as inverted yellow (reverse video)\nand headings with yellow on blue using `--pretty`:\n\n    ug --pretty --colors=\"ms=yi:fn=hyB\" -r -n -tc++ -f c++/includes -f c++/defines\n\nTo list all `#define FOO...` macros in C++ files, color-highlighted:\n\n    ug --color=always -r -n -tc++ -f c++/defines | ug 'FOO.*'\n\nSame, but restricted to `.cpp` files only:\n\n    ug --color=always -r -n -Ocpp -f c++/defines | ug 'FOO.*'\n\nTo search tarballs for matching names of PDF files (assuming bash is our shell):\n\n    for tb in *.tar *.tar.gz *.tgz; do echo \"$tb\"; tar tfz \"$tb\" | ugrep '.*\\.pdf$'; done\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"json\"/\u003e\n\n### Output matches in JSON, XML, CSV, C++\n\n    --cpp   Output file matches in C++.  See also options --format and -u.\n    --csv   Output file matches in CSV.  If -H, -n, -k, or -b is specified,\n            additional values are output.  See also options --format and -u.\n    --json  Output file matches in JSON.  If -H, -n, -k, or -b is specified,\n            additional values are output.  See also options --format and -u.\n    --xml   Output file matches in XML.  If -H, -n, -k, or -b is specified,\n            additional values are output.  See also options --format and -u.\n\nTo recursively search for lines with `TODO` and display C++ file matches in\nJSON with line number properties:\n\n    ug -tc++ -n --json 'TODO'\n\nTo recursively search for lines with `TODO` and display C++ file matches in\nXML with line and column number attributes:\n\n    ug -tc++ -nk --xml 'TODO'\n\nTo recursively search for lines with `TODO` and display C++ file matches in CSV\nformat with file pathname, line number, and column number fields:\n\n    ug -tc++ --csv -Hnk 'TODO'\n\nTo extract a table from an HTML file and put it in C/C++ source code using\n`-o`:\n\n    ug -o --cpp '\u003ctr\u003e.*\u003c/tr\u003e' index.html \u003e table.cpp\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"format\"/\u003e\n\n### Customized output with --format\n\n    --format=FORMAT\n            Output FORMAT-formatted matches.  For example --format='%f:%n:%O%~'\n            outputs matching lines `%O' with filename `%f` and line number `%n'\n            followed by a newline `%~'.  If -P is specified, FORMAT may include\n            `%1' to `%9', `%[NUM]#' and `%[NAME]#' to output group captures.  A\n            `%%' outputs `%'.  See `ugrep --help format' and `man ugrep'\n            section FORMAT for details.  When option -o is specified, option -u\n            is also enabled.  Context options -A, -B, -C and -y are ignored.\n    -P, --perl-regexp\n            Interpret PATTERN as a Perl regular expression.\n\nUse option `-P` to use group captures and backreferences.  Capturing groups in\nregex patterns are parenthesized expressions `(pattern)`.  The first group is\nreferenced in `FORMAT` by `%1`, the second by `%2` and so on.  Named captures\nare of the form `(?\u003cNAME\u003epattern)` and are referenced in `FORMAT` by\n`%[NAME]#`.\n\nThe following output formatting options may be used.  The `FORMAT` string\n`%`-fields are listed in a table further below:\n\noption                  | result\n----------------------- | ------------------------------------------------------\n`--format-begin=FORMAT` | `FORMAT` beginning the search\n`--format-open=FORMAT`  | `FORMAT` opening a file and a match was found\n`--format=FORMAT`       | `FORMAT` for each match in a file\n`--format-close=FORMAT` | `FORMAT` closing a file and a match was found\n`--format-end=FORMAT`   | `FORMAT` ending the search\n\nThe following tables show the formatting options corresponding to `--csv`,\n`--json`, and `--xml`.\n\n#### `--csv`\n\noption           | format string (within quotes)\n---------------- | -----------------------------\n`--format-open`  | `'%+'`\n`--format`       | `'%[,]$%H%N%K%B%V%~%u'`\n\n#### `--json`\n\noption           | format string (within quotes)\n---------------- | -----------------------------\n`--format-begin` | `'['`\n`--format-open`  | `'%,%~  {%~    %[,%~    ]$%[\"file\": ]H\"matches\": ['`\n`--format`       | `'%,%~      { %[, ]$%[\"line\": ]N%[\"column\": ]K%[\"offset\": ]B\"match\": %J }%u'`\n`--format-close` | `'%~    ]%~  }'`\n`--format-end`   | `'%~]%~'`\n\n#### `--xml`\n\noption           | format string (within quotes)\n---------------- | -----------------------------\n`--format-begin` | `'\u003cgrep\u003e%~'`\n`--format-open`  | `'  \u003cfile%[\"]$%[ name=\"]I\u003e%~'`\n`--format`       | `'    \u003cmatch%[\"]$%[ line=\"]N%[ column=\"]K%[ offset=\"]B\u003e%X\u003c/match\u003e%~%u'`\n`--format-close` | `'  \u003c/file\u003e%~'`\n`--format-end`   | `'\u003c/grep\u003e%~'`\n\n### `--only-line-number`\n\noption           | format string (within quotes)\n---------------- | -----------------------------\n`--format-open`  | `'%+'`\n`--format`       | `'%F%n%s%K%B%~%u'`\n\nThe following fields may be used in the `FORMAT` string:\n\nfield                   | output\n----------------------- | ------------------------------------------------------\n`%%`                    | the percentage sign\n`%~`                    | a newline (LF or CRLF in Windows)\n`%F`                    | if option `-H` is used: the file pathname and separator\n`%[TEXT]F`              | if option `-H` is used: `TEXT`, the file pathname and separator\n`%f`                    | the file pathname\n`%a`                    | the file basename without directory path\n`%p`                    | the directory path to the file\n`%z`                    | the pathname in a (compressed) archive, without `{` and `}`\n`%H`                    | if option `-H` is used: the quoted pathname and separator, `\\\"` and `\\\\` replace `\"` and `\\`\n`%+`                    | if option `-+` or `--heading` is used: `%F` and a newline character, suppress all `%F` and `%H` afterward\n`%[TEXT]H`              | if option `-H` is used: `TEXT`, the quoted pathname and separator, `\\\"` and `\\\\` replace `\"` and `\\`\n`%h`                    | the quoted file pathname, `\\\"` and `\\\\` replace `\"` and `\\`\n`%I`                    | if option `-H` is used: the pathname in XML and separator\n`%[TEXT]I`              | if option `-H` is used: `TEXT`, the pathname as XML and separator\n`%i`                    | the file pathnames as XML\n`%N`                    | if option `-n` is used: the line number and separator\n`%[TEXT]N`              | if option `-n` is used: `TEXT`, the line number and separator\n`%n`                    | the line number of the match\n`%l`                    | the last line number of the match (multi-line matching)\n`%L`                    | the number of lines matched (multi-line matching)\n`%K`                    | if option `-k` is used: the column number and separator\n`%[TEXT]K`              | if option `-k` is used: `TEXT`, the column number and separator\n`%k`                    | the column number of the match\n`%A`                    | byte range (offset and end) of a match in hex\n`%B`                    | if option `-b` is used: the byte offset and separator\n`%[TEXT]B`              | if option `-b` is used: `TEXT`, the byte offset and separator\n`%b`                    | the byte offset of the match\n`%T`                    | if option `-T` is used: `TEXT` and a tab character\n`%[TEXT]T`              | if option `-T` is used: `TEXT` and a tab character\n`%t`                    | a tab character\n`%[SEP]$`               | set field separator to `SEP` for the rest of the format fields\n`%[TEXT]\u003c`              | if the first match: `TEXT`\n`%[TEXT]\u003e`              | if not the first match: `TEXT`\n`%,`                    | if not the first match: a comma, same as `%[,]\u003e`\n`%:`                    | if not the first match: a colon, same as `%[:]\u003e`\n`%;`                    | if not the first match: a semicolon, same as `%[;]\u003e`\n`%│`                    | if not the first match: a vertical bar, same as `%[│]\u003e`\n`%S`                    | if not the first match: separator, see also `%[SEP]$`\n`%[TEXT]S`              | if not the first match: `TEXT` and separator, see also `%[SEP]$`\n`%s`                    | the separator, see also `%[TEXT]S` and `%[SEP]$`\n`%R`                    | if option `--break` or `--heading` is used: a newline\n`%m`                    | the number of matches, sequential (or number of matching files with `--format-end`)\n`%M`                    | the number of matching lines (or number of matching files with `--format-end`)\n`%O`                    | the matching line is output as is (a raw string of bytes)\n`%o`                    | the match is output as is (a raw string of bytes)\n`%Q`                    | the matching line as a quoted string, `\\\"` and `\\\\` replace `\"` and `\\`\n`%q`                    | the match as a quoted string, `\\\"` and `\\\\` replace `\"` and `\\`\n`%C`                    | the matching line formatted as a quoted C/C++ string\n`%c`                    | the match formatted as a quoted C/C++ string\n`%J`                    | the matching line formatted as a quoted JSON string\n`%j`                    | the match formatted as a quoted JSON string\n`%V`                    | the matching line formatted as a quoted CSV string\n`%v`                    | the match formatted as a quoted CSV string\n`%X`                    | the matching line formatted as XML character data\n`%x`                    | the match formatted as XML character data\n`%Y`                    | the matching line formatted in hex\n`%y`                    | the match formatted in hex\n`%A`                    | byte range of the match in hex\n`%w`                    | the width of the match, counting (wide) characters\n`%d`                    | the size of the match, counting bytes\n`%e`                    | the ending byte offset of the match\n`%Z`                    | the edit distance cost of an approximate match with option `-Z`\n`%u`                    | select unique lines only unless option -u is used\n`%[hhhh]U`              | U+hhhh Unicode code point\n`%[CODE]=`              | a color CODE, such as `ms`, see [colors](#color)\n`%=`                    | turn color off\n`%1` `%2` ... `%9`      | the first regex group capture of the match, and so on up to group `%9`, requires option `-P`\n`%[NUM]#`               | the group capture `NUM`; requires option `-P`\n`%[NUM]b`               | the byte offset of the group capture `NUM`; requires option `-P`\n`%[NUM]e`               | the ending byte offset of the group capture `NUM`; requires option `-P`\n`%[NUM]d`               | the byte length of the group capture `NUM`; requires option `-P`\n`%[NUM]j`               | the group capture `NUM` as JSON; requires option `-P`\n`%[NUM]q`               | the group capture `NUM` quoted; requires option `-P`\n`%[NUM]x`               | the group capture `NUM` as XML; requires option `-P`\n`%[NUM]y`               | the group capture `NUM` as hex; requires option `-P`\n`%[NUM]v`               | the group capture `NUM` as CSV; requires option `-P`\n`%[NUM1\\|NUM2\\|...]#`   | the first group capture `NUM` that matched; requires option `-P`\n`%[NUM1\\|NUM2\\|...]b`   | the byte offset of the first group capture `NUM` that matched; requires option `-P`.\n`%[NUM1\\|NUM2\\|...]e`   | the ending byte offset of the first group capture `NUM` that matched; requires option `-P`.\n`%[NUM1\\|NUM2\\|...]d`   | the byte length of the first group capture `NUM` that matched; requires option `-P`.\n`%[NUM1\\|NUM2\\|...]j`   | the first group capture `NUM` that matched, as JSON; requires option `-P`\n`%[NUM1\\|NUM2\\|...]q`   | the first group capture `NUM` that matched, quoted; requires option `-P`\n`%[NUM1\\|NUM2\\|...]x`   | the first group capture `NUM` that matched, as XML; requires option `-P`\n`%[NUM1\\|NUM2\\|...]y`   | the first group capture `NUM` that matched, as hex; requires option `-P`\n`%[NUM1\\|NUM2\\|...]v`   | the first group capture `NUM` that matched, as CSV; requires option `-P`\n`%[NAME]#`              | the `NAME`d group capture; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME]b`              | the byte offset of the `NAME`d group capture; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`.\n`%[NAME]e`              | the ending byte offset of the `NAME`d group capture; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`.\n`%[NAME]d`              | the byte length of the `NAME`d group capture; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`.\n`%[NAME]j`              | the `NAME`d group capture as JSON; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME]q`              | the `NAME`d group capture quoted; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME]x`              | the `NAME`d group capture as XML; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME]y`              | the `NAME`d group capture as hex; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME]v`              | the `NAME`d group capture as CSV; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME1\\|NAME2\\|...]#` | the first `NAME`d group capture that matched; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME1\\|NAME2\\|...]b` | the byte offset of the first `NAME`d group capture that matched; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME1\\|NAME2\\|...]e` | the ending byte offset of the first `NAME`d group capture that matched; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME1\\|NAME2\\|...]d` | the byte length of the first `NAME`d group capture that matched; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME1\\|NAME2\\|...]j` | the first `NAME`d group capture that matched, as JSON; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME1\\|NAME2\\|...]q` | the first `NAME`d group capture that matched, quoted; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME1\\|NAME2\\|...]x` | the first `NAME`d group capture that matched, as XML; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME1\\|NAME2\\|...]y` | the first `NAME`d group capture that matched, as hex; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%[NAME1\\|NAME2\\|...]v` | the first `NAME`d group capture that matched, as CSV; requires option `-P` and capturing pattern `(?\u003cNAME\u003ePATTERN)`\n`%G`                    | list of group capture indices/names of the match (see note)\n`%[TEXT1\\|TEXT2\\|...]G` | list of TEXT indexed by group capture indices that matched; requires option `-P`\n`%g`                    | the group capture index of the match or 1 (see note)\n`%[TEXT1\\|TEXT2\\|...]g` | the first TEXT indexed by the first group capture index that matched; requires option `-P`\n\nNote:\n\n- Formatted output is written without a terminating newline, unless `%~` is\n  explicitly specified in the format string.\n- Option `-o` changes the output of the `%O` and `%Q` fields to output the\n  match only.\n- Options `-c`, `-l` and `-o` change the output of `%C`, `%J`, `%X` and `%Y`\n  accordingly\n- The `[TEXT]` part of a field is optional and may be omitted.  When present,\n  the argument must be placed in `[]` brackets, for example `%[,]F` to output a\n  comma, the pathname, and a separator, when option `-H` is used.\n- Numeric fields such as `%n` are padded with spaces when `%{width}n` is\n  specified.\n- Matching line fields such as `%O` are cut to width when `%{width}O` is\n  specified or when `%{-width}O` is specified to cut from the end of the line.\n- Character context on a matching line before or after a match is output when\n  `%{-width}o` or `%{+width}o` is specified for match fields such as `%o`,\n  where `%{width}o` without a +/- sign cuts the match to the specified width.\n- Fields `%[SEP]$` and `%u` are switches and do not write anything to the\n  output.\n- The separator used by `%F`, `%H`, `%N`, `%K`, `%B`, `%S`, and `%G` may be\n  changed by preceding the field with a `%[SEP]$`.  When `[SEP]` is not\n  provided, reverts the separator to the default separator or the separator\n  specified by `--separator`.\n- Formatted output is written for each matching pattern, which means that a\n  line may be output multiple times when patterns match more than once on the\n  same line.  When field `%u` is found anywhere in the specified format string,\n  matching lines are output only once unless option `-u`, `--ungroup`\n  is used or when a newline is matched.\n- The group capture index value output by `%g` corresponds to the index of the\n  sub-pattern matched among the alternations in the pattern when option `-P` is\n  not used.  For example `foo|bar` matches `foo` with index 1 and `bar` with\n  index 2.  With option `-P`, the index corresponds to the number of the first\n  group captured in the specified pattern.\n- The strings specified in the list `%[TEXT1|TEXT2|...]G` and\n  `%[TEXT1|TEXT2|...]g` should correspond to the group capture index (see the\n  note above), i.e. `TEXT1` is output for index 1, `TEXT2` is output for index\n  2, and so on.  If the list is too short, the index value is output or the\n  name of a named group capture is output.\n- Option `-T` and `--pretty` add right-justifying spacing to fields `%N` and\n  `%K` if no leading `[TEXT]` part is specified.\n- Field `%+` may be used in `--format-open` to output the pathname heading and\n   a newline break, respectively.  Field `%+` suppresses `%a`, `%F`, `%f`,\n   `%H`, `%h` and `%p` output.\n\nTo output matching lines faster by omitting the header output and binary match\nchecks, using `--format` with field `%O` (output matching line as is) and field\n`%~` (output newline):\n\n    ug --format='%O%~' 'href=' index.html\n\nSame, but also displaying the line and column numbers:\n\n    ug --format='%n%k: %O%~' 'href=' index.html\n\nSame, but display a line at most once when matching multiple patterns, unless\noption `-u` is used:\n\n    ug --format='%u%n%k: %O%~' 'href=' index.html\n\nTo string together a list of unique line numbers of matches, separated by\ncommas with field `%,`:\n\n    ug --format='%u%,%n' 'href=' index.html\n\nTo output the matching part of a line only with field `%o` (or option `-o` with\nfield `%O`):\n\n    ug --format='%o%~' \"href=[\\\"'][^\\\"'][\\\"']\" index.html\n\nTo string together the pattern matches as CSV-formatted strings with field `%v`\nseparated by commas with field `%,`:\n\n    ug --format='%,%v' \"href=[\\\"'][^\\\"'][\\\"']\" index.html\n\nTo output matches in CSV (comma-separated values), the same as option `--csv`\n(works with options `-H`, `-n`, `-k`, `-b` to add CSV values):\n\n    ug --format='\"%[,]$%H%N%K%B%V%~%u\"' 'href=' index.html\n\nTo output matches in AckMate format:\n\n    ug --format=\":%f%~%n;%k %w:%O%~\" 'href=' index.html\n\nTo output the sub-pattern indices 1, 2, and 3 on the left to the match for the\nthree patterns `foo`, `bar`, and `baz` in file `foobar.txt`:\n\n    ug --format='%g: %o%~' 'foo|bar|baz' foobar.txt\n\nSame, but using a file `foos` containing three lines with `foo`, `bar`, and\n`baz`, where option `-F` is used to match strings instead of regex:\n\n    ug -F -f foos --format='%g: %o%~' foobar.txt\n\nTo output `one`, `two`, and `a word` for the sub-patterns `[fF]oo`, `[bB]ar`,\nand any other word `\\w+`, respectively, using argument `[one|two|a word]` with\nfield `%g` indexed by sub-pattern (or group captures with option `-P`):\n\n    ug --format='%[one|two|a word]g%~' '([fF]oo)|([bB]ar)|(\\w+)' foobar.txt\n\nTo output a list of group capture indices with `%G` separated by the word `and`\ninstead of the default colons with `%[ and ]$`, followed by the matching line:\n\n    ug -P --format='%[ and ]$%G%$%s%O%~' '(foo)|(ba((r)|(z)))' foobar.txt\n\nSame, but showing names instead of numbers:\n\n    ug -P --format='%[ and ]$%[foo|ba|r|z]G%$%s%O%~' '(foo)|(ba(?:(r)|(z)))' foobar.txt\n\nNote that option `-P` is required for general use of group captures for\nsub-patterns.  Named sub-pattern matches may be used with PCRE2 and shown in\nthe output:\n\n    ug -P --format='%[ and ]$%G%$%s%O%~' '(?P\u003cfoo\u003efoo)|(?P\u003cba\u003eba(?:(?P\u003cr\u003er)|(?P\u003cz\u003ez)))' foobar.txt\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"replace\"/\u003e\n\n### Replacing matches with -P --replace and --format using backreferences\n\n    --replace=FORMAT\n            Replace matching patterns in the output by the specified FORMAT\n            with `%' fields.  If -P is specified, FORMAT may include `%1' to\n            `%9', `%[NUM]#' and `%[NAME]#' to output group captures.  A `%%'\n            outputs `%' and `%~' outputs a newline.  See option --format,\n            `ugrep --help format' and `man ugrep' section FORMAT for details.\n    -y, --any-line\n            Any line is output (passthru).  Non-matching lines are output as\n            context with a `-' separator.  See also options -A, -B, and -C.\n    -P, --perl-regexp\n            Interpret PATTERN as a Perl regular expression.\n    --format=FORMAT\n            Output FORMAT-formatted matches.  For example --format='%f:%n:%O%~'\n            outputs matching lines `%O' with filename `%f` and line number `%n'\n            followed by a newline `%~'.  If -P is specified, FORMAT may include\n            `%1' to `%9', `%[NUM]#' and `%[NAME]#' to output group captures.  A\n            `%%' outputs `%'.  See `ugrep --help format' and `man ugrep'\n            section FORMAT for details.  When option -o is specified, option -u\n            is also enabled.  Context options -A, -B, -C and -y are ignored.\n\nSee [customized output with --format](#format) for details on the `FORMAT`\nfields.\n\nFor option `-o`, the replacement is not automatically followed by a newline to\nallow for more flexibility in replacements.  To output a newline, use `%~` in\nthe `FORMAT` string.\n\nUse option `-P` to use group captures and backreferences.  Capturing groups in\nregex patterns are parenthesized expressions `(pattern)` and the first is\nreferenced in `FORMAT` by `%1`, the second by `%2` and so on.  Named captures\nare of the form `(?\u003cNAME\u003epattern)` and are referenced in `FORMAT` by\n`%[NAME]#`.\n\nTo display pattern matches with their sequential match number using\n`--replace='%m:%o'` where `%m` is the sequential match number and `%o` is the\npattern matched:\n\n    ug --replace='%m:%o' pattern myfile.txt\n\nSame, but passing the file through with option `-y`, while applying the\nreplacements to the output:\n\n    ug -y --replace='%m:%o' pattern myfile.txt\n\nTo extract table cells from an HTML file using Perl matching (`-P`) to support\ngroup captures with lazy quantifier `(.*?)`, and translate the matches to a\ncomma-separated list with format `%,%1` (conditional comma and group capture):\n\n    ug -P -o '\u003ctd\u003e(.*?)\u003c/td\u003e' --replace='%,%1' index.html\n\nSame, but using `--format='%,%1'` instead and we do not need `-o` (note that\n`--replace` color-highlights matches shown on a terminal but `--format` does\nnot):\n\n    ug -P '\u003ctd\u003e(.*?)\u003c/td\u003e' --format='%,%1' index.html\n\nSame, but displaying the formatted matches line-by-line, with `--replace` or\nwith `--format`:\n\n    ug -P -o '\u003ctd\u003e(.*?)\u003c/td\u003e' --replace='%,%1' index.html\n    ug -P '\u003ctd\u003e(.*?)\u003c/td\u003e' --format='%1%~' index.html\n\nTo collect all `href` URLs from all HTML and PHP files down the working\ndirectory, then sort them:\n\n    ug -r -thtml,php -P '\u003c[^\u003c\u003e]+href\\h*=\\h*.([^\\x27\"]+).' --format='%1%~' | sort -u\n\nSame, but much easier by using the predefined `html/href` pattern:\n\n    ug -r -thtml,php -P -f html/href --format='%1%~' | sort -u\n\nSame, but in this case select `\u003cscript\u003e` `src` URLs when referencing `http` and\n`https` sites:\n\n    ug -r -thtml,php -P '\u003cscript.*src\\h*=\\h*.(https?:[^\\x27\"]+).' --format='%1%~' | sort -u\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"max\"/\u003e\n\n### Limiting the number of matches with -1,-2...-9, -K, -m, and --max-files\n\n    --depth=[MIN,][MAX], -1, -2, -3, ... -9, -10, -11, -12, ...\n            Restrict recursive searches from MIN to MAX directory levels deep,\n            where -1 (--depth=1) searches the specified path without recursing\n            into subdirectories.  Note that -3 -5, -3-5, and -35 search 3 to 5\n            levels deep.  Enables -r if -R or -r is not specified.\n    -K [MIN,][MAX], --range=[MIN,][MAX], --min-line=MIN, --max-line=MAX\n            Start searching at line MIN, stop at line MAX when specified.\n    -m [MIN,][MAX], --min-count=MIN, --max-count=MAX\n            Require MIN matches, stop after MAX matches when specified.  Output\n            MIN to MAX matches.  For example, -m1 outputs the first match and\n            -cm1, (with a comma) counts nonzero matches.  If -u is specified,\n            each individual match counts.  See also option -K.\n    --max-files=NUM\n            Restrict the number of files matched to NUM.  Note that --sort or\n            -J1 may be specified to produce replicable results.  If --sort is\n            specified, the number of threads spawned is limited to NUM.\n    --sort[=KEY]\n            Displays matching files in the order specified by KEY in recursive\n            searches.  Normally the ug command sorts by name whereas the ugrep\n            batch command displays matches in no particular order to improve\n            performance.  The sort KEY can be `name' to sort by pathname\n            (default), `best' to sort by best match with option -Z (sort by\n            best match requires two passes over files, which is expensive),\n            `size' to sort by file size, `used' to sort by last access time,\n            `changed' to sort by last modification time and `created' to sort\n            by creation time.  Sorting is reversed with `rname', `rbest',\n            `rsize', `rused', `rchanged', or `rcreated'.  Archive contents are\n            not sorted.  Subdirectories are sorted and displayed after matching\n            files.  FILE arguments are searched in the same order as specified.\n\nTo show only up to the first 10 matching lines with `FIXME` in C++ files in the\nworking directory and all subdirectories below:\n\n    ug -r -m10 -tc++ FIXME\n\nSame, but recursively search up to two directory levels, meaning that `./` and\n`./sub/` are visited but not deeper:\n\n    ug -2 -m10 -tc++ FIXME\n\nTo show only the first two files that have one or more matches of `FIXME` in\nthe list of files sorted by pathname, using `--max-files=2`:\n\n    ug --sort -r --max-files=2 -tc++ FIXME\n\nTo search file `install.sh` for the occurrences of the word `make` after the\nfirst line, we use `-K` with line number 2 to start searching, where `-n` shows\nthe line numbers in the output:\n\n    ug -n -K2 -w make install.sh\n\nSame, but restricting the search to lines 2 to 40 (inclusive):\n\n    ug -n -K2,40 -w make install.sh\n\nSame, but showing all lines 2 to 40 with `-y`:\n\n    ug -y -n -K2,40 -w make install.sh\n\nSame, but showing only the first four matching lines after line 2, with one\nline of context:\n\n    ug -n -C1 -K2 -m4 -w make install.sh\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"empty\"/\u003e\n\n### Matching empty patterns with -Y\n\n    -Y, --empty\n            Permits empty matches.  By default, empty matches are disabled,\n            unless a pattern begins with `^' or ends with `$'.  Note that -Y\n            when specified with an empty-matching pattern, such as x? and x*,\n            match all input, not only lines containing the character `x'.\n\nOption `-Y` permits empty pattern matches, like GNU/BSD grep.  This option is\nintroduced by **ugrep** to prevent accidental matching with empty patterns:\nempty-matching patterns such as `x?` and `x*` match all input, not only lines\nwith `x`.  By default, without `-Y`, patterns match lines with at least one `x`\nas intended.\n\nThis option is automatically enabled when a pattern starts with `^` or ends\nwith `$` is specified.  For example, `^\\h*$` matches blank lines, including\nempty lines.\n\nTo recursively list files in the working directory with blank lines, i.e. lines\nwith white space only, including empty lines (note that option `-Y` is\nimplicitly enabled since the pattern starts with `^` and ends with `$`):\n\n    ug -l '^\\h*$'\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"case\"/\u003e\n\n### Case-insentitive matching with -i and -j\n\n    -i, --ignore-case\n            Perform case insensitive matching.  By default, ugrep is case\n            sensitive.  By default, this option applies to ASCII letters only.\n            Use options -P and -i for Unicode case insensitive matching.\n    -j, --smart-case\n            Perform case insensitive matching like option -i, unless a pattern\n            is specified with a literal ASCII upper case letter.\n\nTo match `todo` in `myfile.cpp` regardless of case:\n\n     ug -i 'todo' myfile.txt\n\nTo match `todo XXX` with `todo` in any case but `XXX` as given, with pattern\n`(?i:todo)` to match `todo` ignoring case:\n\n     ug '(?i:todo) XXX' myfile.cpp\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"sort\"/\u003e\n\n### Sort files by name, best match, size, and time\n\n    --sort[=KEY]\n            Displays matching files in the order specified by KEY in recursive\n            searches.  Normally the ug command sorts by name whereas the ugrep\n            batch command displays matches in no particular order to improve\n            performance.  The sort KEY can be `name' to sort by pathname\n            (default), `best' to sort by best match with option -Z (sort by\n            best match requires two passes over files, which is expensive),\n            `size' to sort by file size, `used' to sort by last access time,\n            `changed' to sort by last modification time and `created' to sort\n            by creation time.  Sorting is reversed with `rname', `rbest',\n            `rsize', `rused', `rchanged', or `rcreated'.  Archive contents are\n            not sorted.  Subdirectories are sorted and displayed after matching\n            files.  FILE arguments are searched in the same order as specified.\n\nMatching files are displayed in the order specified by `--sort` per directory\nsearched.  By default, the `ug` command sorts by name whereas the output of the\n`ugrep` command is not sorted to improve performance, unless option `-Q` is\nused which sorts files by name.  An optimized sorting method and strategy are\nimplemented in the asynchronous output class to keep the overhead of sorting\nvery low.  Directories are displayed after files are displayed first, when\nrecursing, which visually aids the user in finding the \"closest\" matching files\nfirst at the top of the displayed results.\n\nTo recursively search for C++ files that match `main` and sort them by date\ncreated:\n\n    ug --sort=created -tc++ 'main'\n\nSame, but sorted by time changed from most recent to oldest:\n\n    ug --sort=rchanged -tc++ 'main'\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"tips\"/\u003e\n\n### Tips for advanced users\n\nWhen searching non-binary files only, the binary content check is disabled with\noption `-a` (`--text`) to speed up searching and displaying pattern matches.\nFor example, searching for lines with `int` in C++ source code:\n\n    ug -r -a -Ocpp -w 'int'\n\nIf a file has potentially many pattern matches, but each match is only one a\nsingle line, then option `-u` (`--ungroup`) can speed this up:\n\n    ug -r -a -u -Opython -w 'def'\n\nEven greater speeds can be achieved with `--format` when searching files with\nmany matches.  For example, `--format='%O%~'` displays matching lines for each\nmatch on that line, while `--format='%o%~'` displays the matching part only.\nNote that the `--format` option does not check for binary matches, so the\noutput is always \"as is\".  To match text and binary, you can use\n`--format='%C%~'` to display matches formatted as quoted C++ strings with\nescapes.  To display a line at most once (unless option `-u` is used), add the\n`%u` (unique) field to the format string, e.g. `--format='%u%O%~'`.\n\nFor example, to match all words recursively in the working directory with line\nand column numbers, where `%n` is the line number, `%k` is the column number,\n`%o` is the match (only matching), and `%~` is a newline:\n\n    ug -r --format='%n,%k:%o%~' '\\w+'\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"more\"/\u003e\n\n### More examples\n\nTo search for pattern `-o` in `script.sh` using `-e` to explicitly specify a\npattern to prevent pattern `-o` from being interpreted as an option:\n\n    ug -n -e '-o' script.sh\n\nAlternatively, using `--` to end the list of command arguments:\n\n    ug -n -- '-o' script.sh\n\nTo recursively list all text files (.txt and .md) that do not properly end with\na `\\n` (`-o` is required to match `\\n` or `\\z`):\n\n    ug -L -o -Otext '\\n\\z'\n\nTo list all markdown sections in text files (.text, .txt, .TXT, and .md):\n\n    ug -o -ttext -e '^.*(?=\\r?\\n(===|---))' -e '^#{1,6}\\h+.*'\n\nTo display multi-line backtick and indented code blocks in markdown files with\ntheir line numbers, using a lazy quantifier `*?` to make the pattern compact:\n\n    ug -n -ttext -e '^```(.|\\n)*?\\n```' -e '^(\\t|[ ]{4}).*'\n\nTo find mismatched code (a backtick without matching backtick on the same line)\nin markdown:\n\n    ug -n -ttext -e '`[^`]+' -N '`[^`]*`'\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"man\"/\u003e\n\n### Man page\n\n    UGREP(1)                          User Commands                         UGREP(1)\n\n\n\n    NAME\n           ugrep, ug -- file pattern searcher\n\n    SYNOPSIS\n           ugrep [OPTIONS] [-i] [-Q|PATTERN] [-e PATTERN] [-N PATTERN] [-f FILE]\n                 [-F|-G|-P|-Z] [-U] [-m [MIN,][MAX]] [--bool [--files|--lines]]\n                 [-r|-R|-1|...|-9|-10|...] [-t TYPES] [-g GLOBS] [--sort[=KEY]]\n                 [-l|-c] [-o] [-n] [-k] [-b] [-A NUM] [-B NUM] [-C NUM] [-y]\n                 [--color[=WHEN]|--colour[=WHEN]] [--pretty] [--pager[=COMMAND]]\n                 [--hexdump|--csv|--json|--xml] [-I] [-z] [--zmax=NUM] [FILE ...]\n\n    DESCRIPTION\n           The ugrep utility searches any given input files, selecting files and\n           lines that match one or more patterns specified as regular expressions or\n           as fixed strings.  A pattern matches multiple input lines when the\n           pattern's regular expression matches one or more newlines.  An empty\n           pattern matches every line.  Each input line that matches at least one of\n           the patterns is written to the standard output.\n\n           The ug command is intended for interactive searching, using a .ugrep\n           configuration file located in the working directory or home directory,\n           see CONFIGURATION.  ug is equivalent to ugrep --config --pretty --sort to\n           load a .ugrep file, enhance the terminal output, and sort files by name.\n\n           The ugrep+ and ug+ commands are the same as the ugrep and ug commands,\n           but also use filters to search pdfs, documents, e-books, and image\n           metadata, when the corresponding filter tools are installed.\n\n           A list of matching files is produced with option -l (--files-with-\n           matches).  Option -c (--count) counts the number of matching lines.  When\n           combined with option -o, counts the total number of matches.  When\n           combined with option -m1, (--min-count=1), skips files with zero matches.\n\n           The default pattern syntax is an extended form of the POSIX ERE syntax,\n           same as option -E (--extended-regexp).  Try ug --help regex for help with\n           pattern syntax and how to use logical connectives to specify Boolean\n           search queries with option -% (--bool) to match lines and -%% (--bool\n           --files) to match files.  Options -F (--fixed-strings), -G (--basic-\n           regexp) and -P (--perl-regexp) specify other pattern syntaxes.\n\n           Option -i (--ignore-case) ignores case in ASCII patterns.  When combined\n           with option -P, ignores case in Unicode patterns.  Option -j (--smart-\n           case) enables -i only if the search patterns are specified in lower case.\n\n           Fuzzy (approximate) search is specified with option -Z (--fuzzy) with an\n           optional argument to control character insertions, deletions, and/or\n           substitutions.  Try ug --help fuzzy for help with fuzzy search.\n\n           Note that pattern `.' matches any non-newline character.  Pattern `\\n'\n           matches a newline character.  Multiple lines may be matched with patterns\n           that match one or more newline characters.\n\n           The empty pattern \"\" matches all lines.  Other empty-matching patterns do\n           not.  For example, the pattern `a*' will match one or more a's.  Option\n           -Y forces empty matches for compatibility with other grep tools.\n\n           Option -f FILE matches patterns specified in FILE.\n\n           By default Unicode patterns are matched.  Option -U (--ascii or --binary)\n           disables Unicode matching for ASCII and binary pattern matching.  Non-\n           Unicode matching is more efficient.\n\n           ugrep accepts input of various encoding formats and normalizes the output\n           to UTF-8.  When a UTF byte order mark is present in the input, the input\n           is automatically normalized.  An input encoding format may be specified\n           with option --encoding.\n\n           If no FILE arguments are specified and standard input is read from a\n           terminal, recursive searches are performed as if -r is specified.  To\n           force reading from standard input, specify `-' as a FILE argument.\n\n           Directories specified as FILE arguments are searched without recursing\n           deeper into subdirectories, unless -R, -r, or -2...-9 is specified to\n           search subdirectories recursively (up to the specified depth.)\n\n           Option -I (--ignore-binary) ignores binary files.  A binary file is a\n           file with non-text content.  A file with zero bytes or invalid UTF\n           formatting is considered binary.\n\n           Hidden files and directories are ignored in recursive searches.  Option\n           -. (--hidden) includes hidden files and directories in recursive\n           searches.\n\n           To match the names of files to search and the names of directories to\n           recurse, one or more of the following options may be specified.  Option\n           -O specifies one or more filename extensions to match.  Option -t\n           specifies one or more file types to search (-t list outputs a list of\n           types.)  Option -g specifies a gitignore-style glob pattern to match\n           filenames.  Option --ignore-files specifies a file with gitignore-style\n           globs to ignore directories and files.  Try ug --help globs for help with\n           filename and directory name matching.  See also section GLOBBING.\n\n           Compressed files and archives are searched with option -z (--decompress).\n           When used with option --zmax=NUM, searches the contents of compressed\n           files and archives stored within archives up to NUM levels.\n\n           A query terminal user interface (TUI) is opened with -Q (--query) to\n           interactively specify search patterns and view search results.  A PATTERN\n           argument requires -e PATTERN to start the query TUI with the specified\n           pattern.\n\n           Output to a terminal for viewing is enhanced with --pretty, which is\n           enabled by default with the ug command.\n\n           A terminal output pager is enabled with --pager.\n\n           Customized output is produced with option --format or --replace.  Try ug\n           --help format for help with custom formatting of the output.  Predefined\n           formats include CSV with option --csv, JSON with option --json, and XML\n           with option --xml.  Hexdumps are output with option -X (--hex) or with\n           option --hexdump to customize hexdumps.  See also section FORMAT.\n\n           A `--' signals the end of options; the rest of the parameters are FILE\n           arguments, allowing filenames to begin with a `-' character.\n\n           Long options may start with `--no-' to disable, when applicable.\n\n           ug --help WHAT displays help on options related to WHAT.\n\n           The following options are available:\n\n           -A NUM, --after-context=NUM\n                  Output NUM lines of trailing context after matching lines.  Places\n                  a --group-separator between contiguous groups of matches.  If -o\n                  is specified, output the match with context to fit NUM columns\n                  after the match or shortens the match.  See also options -B, -C\n                  and -y.\n\n           -a, --text\n                  Process a binary file as if it were text.  This is equivalent to\n                  the --binary-files=text option.  This option might output binary\n                  garbage to the terminal, which can have problematic consequences\n                  if the terminal driver interprets some of it as terminal commands.\n\n           --all, -@\n                  Search all files except hidden: cancel previous file and directory\n                  search restrictions and cancel --ignore-binary and --ignore-files\n                  when specified.  Restrictions specified after this option, i.e. to\n                  the right, are still applied.  For example, -@I searches all\n                  non-binary files and -@. searches all files including hidden\n                  files.  Note that hidden files and directories are never searched,\n                  unless option -. or --hidden is specified.\n\n           --and [-e] PATTERN\n                  Specify additional PATTERN that must match.  Additional -e PATTERN\n                  following this option is considered an alternative pattern to\n                  match, i.e. each -e is interpreted as an OR pattern enclosed\n                  within the AND.  For example, -e A -e B --and -e C -e D matches\n                  lines with (`A' or `B') and (`C' or `D').  Note that multiple -e\n                  PATTERN are alternations that bind more tightly together than\n                  --and.  Option --stats displays the search patterns applied.  See\n                  also options --not, --andnot, --bool, --files and --lines.\n\n           --andnot [-e] PATTERN\n                  Combines --and --not.  See also options --and, --not and --bool.\n\n           -B NUM, --before-context=NUM\n                  Output NUM lines of leading context before matching lines.  Places\n                  a --group-separator between contiguous groups of matches.  If -o\n                  is specified, output the match with context to fit NUM columns\n                  before the match or shortens the match.  See also options -A, -C\n                  and -y.\n\n           -b, --byte-offset\n                  The offset in bytes of a pattern match is displayed in front of\n                  the respective matched line.  When -u is specified, displays the\n                  offset for each pattern matched on the same line.  Byte offsets\n                  are exact for ASCII, UTF-8 and raw binary input.  Otherwise, the\n                  byte offset in the UTF-8 normalized input is displayed.\n\n           --binary-files=TYPE\n                  Controls searching and reporting pattern matches in binary files.\n                  TYPE can be `binary', `without-match`, `text`, `hex` and\n                  `with-hex'.  The default is `binary' to search binary files and to\n                  report a match without displaying the match.  `without-match'\n                  ignores binary matches.  `text' treats all binary files as text,\n                  which might output binary garbage to the terminal, which can have\n                  problematic consequences if the terminal driver interprets some of\n                  it as commands.  `hex' reports all matches in hexadecimal.\n                  `with-hex' only reports binary matches in hexadecimal, leaving\n                  text matches alone.  A match is considered binary when matching a\n                  zero byte or invalid UTF.  Short options are -a, -I, -U, -W and\n                  -X.\n\n           --bool, -%, -%%\n                  Specifies Boolean query patterns.  A Boolean query pattern is\n                  composed of `AND', `OR', `NOT' operators and grouping with `('\n                  `)'.  Spacing between subpatterns is the same as `AND', `|' is the\n                  same as `OR' and a `-' is the same as `NOT'.  The `OR' operator\n                  binds more tightly than `AND'.  For example, --bool 'A|B C|D'\n                  matches lines with (`A' or `B') and (`C' or `D'), --bool 'A -B'\n                  matches lines with `A' and not `B'.  Operators `AND', `OR', `NOT'\n                  require proper spacing.  For example, --bool 'A OR B AND C OR D'\n                  matches lines with (`A' or `B') and (`C' or `D'), --bool 'A AND\n                  NOT B' matches lines with `A' without `B'.  Quoted subpatterns are\n                  matched literally as strings.  For example, --bool 'A \"AND\"|\"OR\"'\n                  matches lines with `A' and also either `AND' or `OR'.  Parentheses\n                  are used for grouping.  For example, --bool '(A B)|C' matches\n                  lines with `A' and `B', or lines with `C'.  Note that all\n                  subpatterns in a Boolean query pattern are regular expressions,\n                  unless -F is specified.  Options -E, -F, -G, -P and -Z can be\n                  combined with --bool to match subpatterns as strings or regular\n                  expressions (-E is the default.)  This option does not apply to -f\n                  FILE patterns.  The double short option -%% enables options --bool\n                  --files.  Option --stats displays the Boolean search patterns\n                  applied.  See also options --and, --andnot, --not, --files and\n                  --lines.\n\n           --break\n                  Adds a line break between results from different files.  This\n                  option is enabled by --heading.\n\n           -C NUM, --context=NUM\n                  Output NUM lines of leading and trailing context surrounding each\n                  matching line.  Places a --group-separator between contiguous\n                  groups of matches.  If -o is specified, output the match with\n                  context to fit NUM columns before and after the match or shortens\n                  the match.  See also options -A, -B and -y.\n\n           -c, --count\n                  Only a count of selected lines is written to standard output.\n                  When -o or -u is specified, counts the number of patterns matched.\n                  When -v is specified, counts the number of non-matching lines.\n                  When -m1, (with a comma or --min-count=1) is specified, counts\n                  only matching files without outputting zero matches.\n\n           --color[=WHEN], --colour[=WHEN]\n                  Mark up the matching text with the colors specified with option\n                  --colors or the GREP_COLOR or GREP_COLORS environment variable.\n                  WHEN can be `never', `always', or `auto', where `auto' marks up\n                  matches only when output on a terminal.  The default is `auto'.\n\n           --colors=COLORS, --colours=COLORS\n                  Use COLORS to mark up text.  COLORS is a colon-separated list of\n                  one or more parameters `sl=' (selected line), `cx=' (context\n                  line), `mt=' (matched text), `ms=' (match selected), `mc=' (match\n                  context), `fn=' (file name), `ln=' (line number), `cn=' (column\n                  number), `bn=' (byte offset), `se=' (separator), `qp=' (TUI\n                  prompt), `qe=' (TUI errors), `qr=' (TUI regex), `qm=' (TUI regex\n                  meta characters), `ql=' (TUI regex lists and literals), `qb=' (TUI\n                  regex braces).  Parameter values are ANSI SGR color codes or `k'\n                  (black), `r' (red), `g' (green), `y' (yellow), `b' (blue), `m'\n                  (magenta), `c' (cyan), `w' (white), or leave empty for no color.\n                  Upper case specifies background colors.  A `+' qualifies a color\n                  as bright.  A foreground and a background color may be combined\n                  with font properties `n' (normal), `f' (faint), `h' (highlight),\n                  `i' (invert), `u' (underline).  Parameter `hl' enables file name\n                  hyperlinks.  Parameter `rv' reverses the `sl=' and `cx='\n                  parameters when option -v is specified.  Selectively overrides\n                  GREP_COLORS.  Legacy grep single parameter codes may be specified,\n                  for example --colors='7;32' or --colors=ig to set ms (match\n                  selected).\n\n           --config[=FILE], ---[FILE]\n                  Use configuration FILE.  The default FILE is `.ugrep'.  The\n                  working directory is checked first for FILE, then the home\n                  directory.  The options specified in the configuration FILE are\n                  parsed first, followed by the remaining options specified on the\n                  command line.  The ug command automatically loads a `.ugrep'\n                  configuration file, unless --config=FILE or --no-config is\n                  specified.\n\n           --no-config\n                  Do not automatically load the default .ugrep configuration file.\n\n           --no-confirm\n                  Do not confirm actions in -Q query TUI.  The default is confirm.\n\n           --cpp  Output file matches in C++.  See also options --format and -u.\n\n           --csv  Output file matches in CSV.  When -H, -n, -k, or -b is specified,\n                  additional values are output.  See also options --format and -u.\n\n           -D ACTION, --devices=ACTION\n                  If an input file is a device, FIFO or socket, use ACTION to\n                  process it.  By default, ACTION is `skip', which means that\n                  devices are silently skipped.  When ACTION is `read', devices read\n                  just as if they were ordinary files.\n\n           -d ACTION, --directories=ACTION\n                  If an input file is a directory, use ACTION to process it.  By\n                  default, ACTION is `skip', i.e., silently skip directories unless\n                  specified on the command line.  When ACTION is `read', warn when\n                  directories are read as input.  When ACTION is `recurse', read all\n                  files under each directory, recursively, following symbolic links\n                  only if they are on the command line.  This is equivalent to the\n                  -r option.  When ACTION is `dereference-recurse', read all files\n                  under each directory, recursively, following symbolic links.  This\n                  is equivalent to the -R option.\n\n           --delay=DELAY\n                  Set the default -Q key response delay.  Default is 3 for 300ms.\n\n           --depth=[MIN,][MAX], -1, -2, -3, ... -9, -10, -11, ...\n                  Restrict recursive searches from MIN to MAX directory levels deep,\n                  where -1 (--depth=1) searches the specified path without recursing\n                  into subdirectories.  The short forms -3 -5, -3-5 and -3,5 search\n                  3 to 5 levels deep.  Enables -r if -R or -r is not specified.\n\n           --dotall\n                  Dot `.' in regular expressions matches anything, including\n                  newline.  Note that `.*' matches all input and should not be used.\n\n           -E, --extended-regexp\n                  Interpret patterns as extended regular expressions (EREs). This is\n                  the default.\n\n           -e PATTERN, --regexp=PATTERN\n                  Specify a PATTERN to search the input.  An input line is selected\n                  if it matches any of the specified patterns.  This option is\n                  useful when multiple -e options are used to specify multiple\n                  patterns, or when a pattern begins with a dash (`-'), or to\n                  specify a pattern after option -f or after the FILE arguments.\n\n           --encoding=ENCODING\n                  The encoding format of the input.  The default ENCODING is binary\n                  or UTF-8 which are treated the same.  Therefore, --encoding=binary\n                  has no effect.  Note that option -U or --binary specifies binary\n                  PATTERN matching (text matching is the default).  ENCODING can be:\n                  `binary', `ASCII', `UTF-8', `UTF-16', `UTF-16BE', `UTF-16LE',\n                  `UTF-32', `UTF-32BE', `UTF-32LE', `LATIN1', `ISO-8859-1',\n                  `ISO-8859-2', `ISO-8859-3', `ISO-8859-4', `ISO-8859-5',\n                  `ISO-8859-6', `ISO-8859-7', `ISO-8859-8', `ISO-8859-9',\n                  `ISO-8859-10', `ISO-8859-11', `ISO-8859-13', `ISO-8859-14',\n                  `ISO-8859-15', `ISO-8859-16', `MAC', `MACROMAN', `EBCDIC',\n                  `CP437', `CP850', `CP858', `CP1250', `CP1251', `CP1252', `CP1253',\n                  `CP1254', `CP1255', `CP1256', `CP1257', `CP1258', `KOI8-R',\n                  `KOI8-U', `KOI8-RU', `null-data'.\n\n           --exclude=GLOB\n                  Exclude files whose name matches GLOB, same as -g ^GLOB.  GLOB can\n                  use **, *, ?, and [...] as wildcards and \\ to quote a wildcard or\n                  backslash character literally.  When GLOB contains a `/', full\n                  pathnames are matched.  Otherwise basenames are matched.  When\n                  GLOB ends with a `/', directories are excluded as if --exclude-dir\n                  is specified.  Otherwise files are excluded.  Note that --exclude\n                  patterns take priority over --include patterns.  GLOB should be\n                  quoted to prevent shell globbing.  This option may be repeated.\n\n           --exclude-dir=GLOB\n                  Exclude directories whose name matches GLOB from recursive\n                  searches, same as -g ^GLOB/.  GLOB can use **, *, ?, and [...] as\n                  wildcards and \\ to quote a wildcard or backslash character\n                  literally.  When GLOB contains a `/', full pathnames are matched.\n                  Otherwise basenames are matched.  Note that --exclude-dir patterns\n                  take priority over --include-dir patterns.  GLOB should be quoted\n                  to prevent shell globbing.  This option may be repeated.\n\n           --exclude-from=FILE\n                  Read the globs from FILE and skip files and directories whose name\n                  matches one or more globs.  A glob can use **, *, ?, and [...] as\n                  wildcards and \\ to quote a wildcard or backslash character\n                  literally.  When a glob contains a `/', full pathnames are\n                  matched.  Otherwise basenames are matched.  When a glob ends with\n                  a `/', directories are excluded as if --exclude-dir is specified.\n                  Otherwise files are excluded.  A glob starting with a `!'\n                  overrides previously-specified exclusions by including matching\n                  files.  Lines starting with a `#' and empty lines in FILE are\n                  ignored.  When FILE is a `-', standard input is read.  This option\n                  may be repeated.\n\n           --exclude-fs=MOUNTS\n                  Exclude file systems specified by MOUNTS from recursive searches.\n                  MOUNTS is a comma-separated list of mount points or pathnames to\n                  directories.  When MOUNTS is not specified, only descends into the\n                  file systems associated with the specified file and directory\n                  search targets, i.e. excludes all other file systems.  Note that\n                  --exclude-fs=MOUNTS take priority over --include-fs=MOUNTS.  This\n                  option may be repeated.\n\n           -F, --fixed-strings\n                  Interpret pattern as a set of fixed strings, separated by\n                  newlines, any of which is to be matched.  This makes ugrep behave\n                  as fgrep.  If a PATTERN is specified, or -e PATTERN or -N PATTERN,\n                  then this option has no effect on -f FILE patterns to allow -f\n                  FILE patterns to narrow or widen the scope of the PATTERN search.\n\n           -f FILE, --file=FILE\n                  Read newline-separated patterns from FILE.  White space in\n                  patterns is significant.  Empty lines in FILE are ignored.  If\n                  FILE does not exist, the GREP_PATH environment variable is used as\n                  path to FILE.  If that fails, looks for FILE in\n                  /usr/local/share/ugrep/patterns.  When FILE is a `-', standard\n                  input is read.  Empty files contain no patterns; thus nothing is\n                  matched.  This option may be repeated.\n\n           --filter=COMMANDS\n                  Filter files through the specified COMMANDS first before\n                  searching.  COMMANDS is a comma-separated list of `exts:command\n                  arguments', where `exts' is a comma-separated list of filename\n                  extensions and `command' is a filter utility.  Files matching one\n                  of `exts' are filtered.  A `*' matches any file.  The specified\n                  `command' may include arguments separated by spaces.  An argument\n                  may be quoted to include spacing, commas or a `%'.  A `%' argument\n                  expands into the pathname to search.  For example,\n                  --filter='pdf:pdftotext % -' searches PDF files.  The `%' expands\n                  into a `-' when searching standard input.  When a `%' is not\n                  specified, the filter command should read from standard input and\n                  write to standard output.  Option --label=.ext may be used to\n                  specify extension `ext' when searching standard input.  This\n                  option may be repeated.\n\n           --filter-magic-label=[+]LABEL:MAGIC\n                  Associate LABEL with files whose signature \"magic bytes\" match the\n                  MAGIC regex pattern.  Only files that have no filename extension\n                  are labeled, unless +LABEL is specified.  When LABEL matches an\n                  extension specified in --filter=COMMANDS, the corresponding\n                  command is invoked.  This option may be repeated.\n\n           --format=FORMAT\n                  Output FORMAT-formatted matches.  For example\n                  --format='%f:%n:%O%~' outputs matching lines `%O' with filename\n                  `%f` and line number `%n' followed by a newline `%~'.  If -P is\n                  specified, FORMAT may include `%1' to `%9', `%[NUM]#' and\n                  `%[NAME]#' to output group captures.  A `%%' outputs `%'.  See\n                  `ugrep --help format' and `man ugrep' section FORMAT for details.\n                  When option -o is specified, option -u is also enabled.  Context\n                  options -A, -B, -C and -y are ignored.\n\n           --free-space\n                  Spacing (blanks and tabs) in regular expressions are ignored.\n\n           -G, --basic-regexp\n                  Interpret patterns as basic regular expressions (BREs).\n\n           -g GLOBS, --glob=GLOBS, --iglob=GLOBS\n                  Only search files whose name matches the specified comma-separated\n                  list of GLOBS, same as --include=glob for each `glob' in GLOBS.\n                  When a `glob' is preceded by a `!' or a `^', skip files whose name\n                  matches `glob', same as --exclude='glob'.  When `glob' contains a\n                  `/', full pathnames are matched.  Otherwise basenames are matched.\n                  When `glob' ends with a `/', directories are matched, same as\n                  --include-dir='glob' and --exclude-dir='glob'.  A leading `/'\n                  matches the working directory.  Option --iglob performs\n                  case-insensitive name matching.  This option may be repeated and\n                  may be combined with options -M, -O and -t.  For more details, see\n                  `ugrep --help globs' and `man ugrep' section GLOBBING for details.\n\n           --glob-ignore-case\n                  Perform case-insensitive glob matching in general.\n\n           --group-separator[=SEP]\n                  Use SEP as a group separator for context options -A, -B and -C.\n                  The default is a double hyphen (`--').\n\n           --no-group-separator\n                  Removes the group separator line from the output for context\n                  options -A, -B and -C.\n\n           -H, --with-filename\n                  Always print the filename with output lines.  This is the default\n                  when there is more than one file to search.\n\n           -h, --no-filename\n                  Never print filenames with output lines.  This is the default when\n                  there is only one file (or only standard input) to search.\n\n           --heading, -+\n                  Group matches per file.  Adds a heading and a line break between\n                  results from different files.  This option is enabled by --pretty\n                  when the output is sent to a terminal.\n\n           --help [WHAT], -? [WHAT]\n                  Display a help message on options related to WHAT when specified.\n                  In addition, `--help regex' displays an overview of regular\n                  expressions, `--help globs' displays an overview of glob syntax\n                  and conventions, `--help fuzzy' displays details of fuzzy search,\n                  and `--help format' displays a list of option --format=FORMAT\n                  fields.\n\n           --hexdump[=[1-8][a][bch][A[NUM]][B[NUM]][C[NUM]]]\n                  Output matches in 1 to 8 columns of 8 hexadecimal octets.  The\n                  default is 2 columns or 16 octets per line.  Argument `a' outputs\n                  a `*' for all hex lines that are identical to the previous hex\n                  line, `b' removes all space breaks, `c' removes the character\n                  column, `h' removes hex spacing, `A' includes up to NUM hex lines\n                  after a match, `B' includes up to NUM hex lines before a match and\n                  `C' includes up to NUM hex lines before and after a match.\n                  Arguments `A', `B' and `C' are the same as options -A, -B and -C\n                  when used with --hexdump.  See also options -U, -W and -X.\n\n           --hidden, -.\n                  Search hidden files and directories (enabled by default in grep\n                  compatibility mode).\n\n           --hyperlink[=[PREFIX][+]]\n                  Hyperlinks are enabled for file names when colors are enabled.\n                  Same as --colors=hl.  When PREFIX is specified, replaces file://\n                  with PREFIX:// in the hyperlink.  A `+' includes the line number\n                  in the hyperlink and when option -k is specified, the column\n                  number.\n\n           -I, --ignore-binary\n                  Ignore matches in binary files.  This option is equivalent to the\n                  --binary-files=without-match option.\n\n           -i, --ignore-case\n                  Perform case insensitive matching.  By default, ugrep is case\n                  sensitive.  By default, this option applies to ASCII letters only.\n                  Use options -P and -i for Unicode case insensitive matching.\n\n           --ignore-files[=FILE]\n                  Ignore files and directories matching the globs in each FILE that\n                  is encountered in recursive searches.  The default FILE is\n                  `.gitignore'.  Matching files and directories located in the\n                  directory of the FILE and in subdirectories below are ignored.\n                  Globbing syntax is the same as the --exclude-from=FILE gitignore\n                  syntax, but files and directories are excluded instead of only\n                  files.  Directories are specifically excluded when the glob ends\n                  in a `/'.  Files and directories explicitly specified as command\n                  line arguments are never ignored.  This option may be repeated to\n                  specify additional files.\n\n           --no-ignore-files\n                  Do not ignore files, i.e. cancel --ignore-files when specified.\n\n           --include=GLOB\n                  Only search files whose name matches GLOB, same as -g GLOB.  GLOB\n                  can use **, *, ?, and [...] as wildcards and \\ to quote a wildcard\n                  or backslash character literally.  When GLOB contains a `/', full\n                  pathnames are matched.  Otherwise basenames are matched.  When\n                  GLOB ends with a `/', directories are included as if --include-dir\n                  is specified.  Otherwise files are included.  Note that --exclude\n                  patterns take priority over --include patterns.  GLOB should be\n                  quoted to prevent shell globbing.  This option may be repeated.\n\n           --include-dir=GLOB\n                  Only directories whose name matches GLOB are included in recursive\n                  searches, same as -g GLOB/.  GLOB can use **, *, ?, and [...] as\n                  wildcards and \\ to quote a wildcard or backslash character\n                  literally.  When GLOB contains a `/', full pathnames are matched.\n                  Otherwise basenames are matched.  Note that --exclude-dir patterns\n                  take priority over --include-dir patterns.  GLOB should be quoted\n                  to prevent shell globbing.  This option may be repeated.\n\n           --include-from=FILE\n                  Read the globs from FILE and search only files and directories\n                  whose name matches one or more globs.  A glob can use **, *, ?,\n                  and [...] as wildcards and \\ to quote a wildcard or backslash\n                  character literally.  When a glob contains a `/', full pathnames\n                  are matched.  Otherwise basenames are matched.  When a glob ends\n                  with a `/', directories are included as if --include-dir is\n                  specified.  Otherwise files are included.  A glob starting with a\n                  `!' overrides previously-specified inclusions by excluding\n                  matching files.  Lines starting with a `#' and empty lines in FILE\n                  are ignored.  When FILE is a `-', standard input is read.  This\n                  option may be repeated.\n\n           --include-fs=MOUNTS\n                  Only file systems specified by MOUNTS are included in recursive\n                  searches.  MOUNTS is a comma-separated list of mount points or\n                  pathnames to directories.  When MOUNTS is not specified, restricts\n                  recursive searches to the file system of the working directory,\n                  same as --include-fs=. (dot). Note that --exclude-fs=MOUNTS take\n                  priority over --include-fs=MOUNTS.  This option may be repeated.\n\n           --index\n                  Perform fast index-based recursive search.  This option assumes,\n                  but does not require, that files are indexed with ugrep-indexer.\n                  This option also enables option -r or --recursive.  Skips indexed\n                  non-matching files, archives and compressed files.  Significant\n                  acceleration may be achieved on cold (not file-cached) and large\n                  file systems, or any file system that is slow to search.  Note\n                  that the start-up time to search may be increased when complex\n                  search patterns are specified that contain large Unicode character\n                  classes combined with `*' or `+' repeats, which should be avoided.\n                  Option -U (--ascii) improves performance.  Option --stats displays\n                  an index search report.\n\n           -J NUM, --jobs=NUM\n                  Specifies the number of threads spawned to search files.  By\n                  default an optimum number of threads is spawned to search files\n                  simultaneously.  -J1 disables threading: files are searched in the\n                  same order as specified.\n\n           -j, --smart-case\n                  Perform case insensitive matching, unless a pattern is specified\n                  with a literal upper case ASCII letter.\n\n           --json Output file matches in JSON.  When -H, -n, -k, or -b is specified,\n                  additional values are output.  See also options --format and -u.\n\n           -K [MIN,][MAX], --range=[MIN,][MAX], --min-line=MIN, --max-line=MAX\n                  Start searching at line MIN, stop at line MAX when specified.\n\n           -k, --column-number\n                  The column number of a pattern match is displayed in front of the\n                  respective matched line, starting at column 1.  Tabs are expanded\n                  in counting columns, see also option --tabs.\n\n           -L, --files-without-match\n                  Only the names of files not containing selected lines are written\n                  to standard output.  Pathnames are listed once per file searched.\n                  If the standard input is searched, the string ``(standard input)''\n                  is written.\n\n           -l, --files-with-matches\n                  Only the names of files containing selected lines are written to\n                  standard output.  ugrep will only search a file until a match has\n                  been found, making searches potentially less expensive.  Pathnames\n                  are listed once per file searched.  If the standard input is\n                  searched, the string ``(standard input)'' is written.\n\n           --label=LABEL\n                  Displays the LABEL value when input is read from standard input\n                  where a file name would normally be printed in the output.\n                  Associates a filename extension with standard input when LABEL has\n                  a suffix.  The default value is `(standard input)'.\n\n           --line-buffered\n                  Force output to be line buffered instead of block buffered.\n\n           --lines\n                  Boolean line matching mode for option --bool, the default mode.\n\n           -M MAGIC, --file-magic=MAGIC\n                  Only search files matching the magic signature pattern MAGIC.  The\n                  signature \"magic bytes\" at the start of a file are compared to the\n                  MAGIC regex pattern.  When matching, the file will be searched.\n                  When MAGIC is preceded by a `!' or a `^', skip files with matching\n                  MAGIC signatures.  This option may be repeated and may be combined\n                  with options -O and -t.  Every file on the search path is read,\n                  making recursive searches potentially more expensive.\n\n           -m [MIN,][MAX], --min-count=MIN, --max-count=MAX\n                  Require MIN matches, stop after MAX matches when specified.\n                  Output MIN to MAX matches.  For example, -m1 outputs the first\n                  match and -cm1, (with a comma) counts nonzero matches.  When -u or\n                  --ungroup is specified, each individual match counts.  See also\n                  option -K.\n\n           --match\n                  Match all input.  Same as specifying an empty pattern to search.\n\n           --max-files=NUM\n                  Restrict the number of files matched to NUM.  Note that --sort or\n                  -J1 may be specified to produce replicable results.  If --sort is\n                  specified, then the number of threads spawned is limited to NUM.\n\n           --mmap[=MAX]\n                  Use memory maps to search files.  By default, memory maps are used\n                  under certain conditions to improve performance.  When MAX is\n                  specified, use up to MAX mmap memory per thread.\n\n           -N PATTERN, --neg-regexp=PATTERN\n                  Specify a negative PATTERN to reject specific -e PATTERN matches\n                  with a counter pattern.  Note that longer patterns take precedence\n                  over shorter patterns, i.e. a negative pattern must be of the same\n                  length or longer to reject matching patterns.  Option -N cannot be\n                  specified with -P.  This option may be repeated.\n\n           -n, --line-number\n                  Each output line is preceded by its relative line number in the\n                  file, starting at line 1.  The line number counter is reset for\n                  each file processed.\n\n           --not [-e] PATTERN\n                  Specifies that PATTERN should not match.  Note that -e A --not -e\n                  B matches lines with `A' or lines without a `B'.  To match lines\n                  with `A' that have no `B', specify -e A --andnot -e B.  Option\n                  --stats displays the search patterns applied.  See also options\n                  --and, --andnot, --bool, --files and --lines.\n\n           --null, -0\n                  Output a zero byte after the file name.  This option can be used\n                  with commands such as `find -print0' and `xargs -0' to process\n                  arbitrary file names, even those that contain newlines.  See also\n                  options -H or --with-filename and --null-data.\n\n           --null-data, -00\n                  Input and output are treated as sequences of lines with each line\n                  terminated by a zero byte instead of a newline; effectively swaps\n                  NUL with LF in the input and the output.  When combined with\n                  option --encoding=ENCODING, output each line terminated by a zero\n                  byte without affecting the input specified as per ENCODING.\n                  Instead of option --null-data, option --encoding=null-data treats\n                  the input as a sequence of lines terminated by a zero byte without\n                  affecting the output.  Option --null-data is not compatible with\n                  UTF-16/32 input.  See also options --encoding and --null.\n\n           -O EXTENSIONS, --file-extension=EXTENSIONS\n                  Only search files whose filename extensions match the specified\n                  comma-separated list of EXTENSIONS, same as -g '*.ext' for each\n                  `ext' in EXTENSIONS.  When an `ext' is preceded by a `!' or a `^',\n                  skip files whose filename extensions matches `ext', same as -g\n                  '^*.ext'.  This option may be repeated and may be combined with\n                  options -g, -M and -t.\n\n           -o, --only-matching\n                  Only the matching part of a pattern match is output.  When -A, -B\n                  or -C is specified, fits the match and its context on a line\n                  within the specified number of columns.\n\n           --only-line-number\n                  Only the line number of a matching line is output.  The line\n                  number counter is reset for each file processed.\n\n           --files, -%%\n                  Boolean file matching mode, the opposite of --lines.  When\n                  combined with option --bool, matches a file if all Boolean\n                  conditions are satisfied.  For example, --bool --files 'A B|C -D'\n                  matches a file if some lines match `A', and some lines match\n                  either `B' or `C', and no line matches `D'.  See also options\n                  --and, --andnot, --not, --bool and --lines.  The double short\n                  option -%% enables options --bool --files.\n\n           -P, --perl-regexp\n                  Interpret PATTERN as a Perl regular expression using PCRE2.  Note\n                  that Perl pattern matching differs from the default grep POSIX\n                  pattern matching.\n\n           -p, --no-dereference\n                  If -R or -r is specified, do not follow symbolic links, even when\n                  symbolic links are specified on the command line.\n\n           --pager[=COMMAND]\n                  When output is sent to the terminal, uses COMMAND to page through\n                  the output.  COMMAND defaults to environment variable PAGER when\n                  defined or `less'.  Enables --heading and --line-buffered.\n\n           --pretty[=WHEN]\n                  When output is sent to a terminal, enables --color, --heading, -n,\n                  --sort, --tree and -T when not explicitly disabled.  WHEN can be\n                  `never', `always', or `auto'.  The default is `auto'.\n\n           -Q[=DELAY], --query[=DELAY]\n                  Query mode: start a TUI to perform interactive searches.  This\n                  mode requires an ANSI capable terminal.  An optional DELAY\n                  argument may be specified to reduce or increase the response time\n                  to execute searches after the last key press, in increments of\n                  100ms, where the default is 3 (300ms delay).  No whitespace may be\n                  given between -Q and its argument DELAY.  Initial patterns may be\n                  specified with -e PATTERN, i.e. a PATTERN argument requires option\n                  -e.  Press F1 or CTRL-Z to view the help screen.  Press F2 or\n                  CTRL-Y to invoke a command to view or edit the file shown at the\n                  top of the screen.  The command can be specified with option\n                  --view and defaults to environment variable PAGER when defined, or\n                  VISUAL or EDITOR.  Press TAB or SHIFT-TAB to navigate directories\n                  and to select a file to search.  Press ENTER to select lines to\n                  output.  Press ALT-l for option -l to list files, ALT-n for -n,\n                  etc.  Non-option commands include ALT-] to increase context and\n                  ALT-} to increase fuzzyness.  If ALT or OPTION keys are not\n                  available, then press CTRL-O + KEY to switch option `KEY', or\n                  press F1 or CTRL-Z for help and press KEY.  See also options\n                  --no-confirm, --delay, --split and --view.\n\n           -q, --quiet, --silent\n                  Quiet mode: suppress all output.  Only search a file until a match\n                  has been found.\n\n           -R, --dereference-recursive\n                  Recursively read all files under each directory, following\n                  symbolic links to files and directories, unlike -r.\n\n           -r, --recursive\n                  Recursively read all files under each directory, following\n                  symbolic links only if they are on the command line.  Note that\n                  when no FILE arguments are specified and input is read from a\n                  terminal, recursive searches are performed as if -r is specified.\n\n           --replace=FORMAT\n                  Replace matching patterns in the output by FORMAT with `%' fields.\n                  If -P is specified, FORMAT may include `%1' to `%9', `%[NUM]#' and\n                  `%[NAME]#' to output group captures.  A `%%' outputs `%' and `%~'\n                  outputs a newline.  See also option --format, `ugrep --help\n                  format' and `man ugrep' section FORMAT for details.\n\n           -S, --dereference-files\n                  When -r is specified, follow symbolic links to files, but not to\n                  directories.  The default is not to follow symbolic links.\n\n           -s, --no-messages\n                  Silent mode: nonexistent and unreadable files are ignored and\n                  their error messages and warnings are suppressed.\n\n           --save-config[=FILE] [OPTIONS]\n                  Save configuration FILE to include OPTIONS.  Update FILE when\n                  first loaded with --config=FILE.  The default FILE is `.ugrep',\n                  which is automatically loaded by the ug command.  When FILE is a\n                  `-', writes the configuration to standard output.  Only part of\n                  the OPTIONS are saved that do not cause searches to fail when\n                  combined with other options.  Additional options may be specified\n                  by editing the saved configuration file.  A configuration file may\n                  be modified manually to specify one or more config[=FILE] to\n                  indirectly load the specified FILE, but recursive config loading\n                  is not allowed.\n\n           --separator[=SEP], --context-separator=SEP\n                  Use SEP as field separator between file name, line number, column\n                  number, byte offset and the matched line.  The default separator\n                  is a colon (`:') and a bar (`|') for multi-line pattern matches,\n                  and a dash (`-') for context lines.  See also option\n                  --group-separator.\n\n           --split\n                  Split the -Q query TUI screen on startup.\n\n           --sort[=KEY]\n                  Displays matching files in the order specified by KEY in recursive\n                  searches.  Normally the ug command sorts by name whereas the ugrep\n                  batch command displays matches in no particular order to improve\n                  performance.  The sort KEY can be `name' to sort by pathname\n                  (default), `best' to sort by best match with option -Z (sort by\n                  best match requires two passes over files, which is expensive),\n                  `size' to sort by file size, `used' to sort by last access time,\n                  `changed' to sort by last modification time and `created' to sort\n                  by creation time.  Sorting is reversed with `rname', `rbest',\n                  `rsize', `rused', `rchanged', or `rcreated'.  Archive contents are\n                  not sorted.  Subdirectories are sorted and displayed after\n                  matching files.  FILE arguments are searched in the same order as\n                  specified.\n\n           --stats\n                  Output statistics on the number of files and directories searched\n                  and the inclusion and exclusion constraints applied.\n\n           -T, --initial-tab\n                  Add a tab space to separate the file name, line number, column\n                  number and byte offset with the matched line.\n\n           -t TYPES, --file-type=TYPES\n                  Search only files associated with TYPES, a comma-separated list of\n                  file types.  Each file type corresponds to a set of filename\n                  extensions passed to option -O and filenames passed to option -g.\n                  For capitalized file types, the search is expanded to include\n                  files with matching file signature magic bytes, as if passed to\n                  option -M.  When a type is preceded by a `!' or a `^', excludes\n                  files of the specified type.  Specifying the initial part of a\n                  type name suffices when the choice is unambiguous.  This option\n                  may be repeated.  The possible file types can be (-tlist displays\n                  a list): `actionscript', `ada', `adoc', `asm', `asp', `aspx',\n                  `autoconf', `automake', `awk', `Awk', `basic', `batch', `bison',\n                  `c', `c++', `clojure', `cpp', `csharp', `css', `csv', `dart',\n                  `Dart', `delphi', `elisp', `elixir', `erlang', `fortran', `gif',\n                  `Gif', `go', `groovy', `gsp', `haskell', `html', `jade', `java',\n                  `jpeg', `Jpeg', `js', `json', `jsp', `julia', `kotlin', `less',\n                  `lex', `lisp', `lua', `m4', `make', `markdown', `matlab', `node',\n                  `Node', `objc', `objc++', `ocaml', `parrot', `pascal', `pdf',\n                  `Pdf', `perl', `Perl', `php', `Php', `png', `Png', `prolog',\n                  `python', `Python', `r', `rpm', `Rpm', `rst', `rtf', `Rtf',\n                  `ruby', `Ruby', `rust', `scala', `scheme', `shell', `Shell',\n                  `smalltalk', `sql', `svg', `swift', `tcl', `tex', `text', `tiff',\n                  `Tiff', `tt', `typescript', `verilog', `vhdl', `vim', `xml',\n                  `Xml', `yacc', `yaml', `zig'.\n\n           --tabs[=NUM]\n                  Set the tab size to NUM to expand tabs for option -k.  The value\n                  of NUM may be 1 (no expansion), 2, 4, or 8.  The default size is\n                  8.\n\n           --tag[=TAG[,END]]\n                  Disables colors to mark up matches with TAG.  END marks the end of\n                  a match if specified, otherwise TAG.  The default is `___'.\n\n           --tree, -^\n                  Output directories with matching files in a tree-like format for\n                  option -c or --count, -l or --files-with-matches, -L or\n                  --files-without-match.  This option is enabled by --pretty when\n                  the output is sent to a terminal.\n\n           -U, --ascii, --binary\n                  Disables Unicode matching for ASCII and binary matching.  PATTERN\n                  matches bytes, not Unicode characters.  For example, -U '\\xa3'\n                  matches byte A3 (hex) instead of the Unicode code point U+00A3\n                  represented by the UTF-8 sequence C2 A3.  See also option\n                  --dotall.\n\n           -u, --ungroup\n                  Do not group multiple pattern matches on the same matched line.\n                  Output the matched line again for each additional pattern match.\n\n           -V, --version\n                  Display version with linked libraries and exit.\n\n           -v, --invert-match\n                  Selected lines are those not matching any of the specified\n                  patterns.\n\n           --view[=COMMAND]\n                  Use COMMAND to view/edit a file in -Q query TUI by pressing\n                  CTRL-Y.\n\n           -W, --with-hex\n                  Output binary matches in hexadecimal, leaving text matches alone.\n                  This option is equivalent to the --binary-files=with-hex option.\n                  To omit the matching line from the hex output, use both options -W\n                  and --hexdump.  See also options -U.\n\n           -w, --word-regexp\n                  The PATTERN is searched for as a word, such that the matching text\n                  is preceded by a non-word character and is followed by a non-word\n                  character.  Word-like characters are Unicode letters, digits and\n                  connector punctuations such as underscore.\n\n           --width[=NUM]\n                  Truncate the output to NUM visible characters per line.  The width\n                  of the terminal window is used if NUM is not specified.  Note that\n                  double-width characters in the output may result in wider lines.\n\n           -X, --hex\n                  Output matches and matching lines in hexadecimal.  This option is\n                  equivalent to the --binary-files=hex option.  To omit the matching\n                  line from the hex output use option --hexdump.  See also option\n                  -U.\n\n           -x, --line-regexp\n                  Select only those matches that exactly match the whole line, as if\n                  the patterns are surrounded by ^ and $.\n\n           --xml  Output file matches in XML.  When -H, -n, -k, or -b is specified,\n                  additional values are output.  See also options --format and -u.\n\n           -Y, --empty\n                  Empty-matching patterns match all lines.  Normally, empty matches\n                  are not output, unless a pattern begins with `^' or ends with `$'.\n                  With this option, empty-matching patterns, such as x? and x*,\n                  match all lines, not only lines with an `x' (enabled by default in\n                  grep compatibility mode).\n\n           -y, --any-line, --passthru\n                  Any line is output (passthru).  Non-matching lines are output as\n                  context with a `-' separator.  See also options -A, -B and -C.\n\n           -Z[best][+-~][MAX], --fuzzy[=[best][+-~][MAX]]\n                  Fuzzy mode: report approximate pattern matches within MAX errors.\n                  The default is -Z1: one deletion, insertion or substitution is\n                  allowed.  If `+`, `-' and/or `~' is specified, then `+' allows\n                  insertions, `-' allows deletions and `~' allows substitutions.\n                  For example, -Z+~3 allows up to three insertions or substitutions,\n                  but no deletions.  If `best' is specified, then only the best\n                  matching lines are output with the lowest cost per file.  Option\n                  -Zbest requires two passes over a file and cannot be used with\n                  standard input or Boolean queries.  Option --sort=best orders\n                  matching files by best match.  The first character of an\n                  approximate match always matches a character at the beginning of\n                  the pattern.  To fuzzy match the first character, replace it with\n                  a `.' or `.?'.  Option -U applies fuzzy matching to ASCII and\n                  bytes instead of Unicode text.  No whitespace may be given between\n                  -Z and its argument.\n\n           -z, --decompress\n                  Search compressed files and archives.  Archives (.cpio, .pax,\n                  .tar) and compressed archives (e.g. .zip, .7z, .taz, .tgz, .tpz,\n                  .tbz, .tbz2, .tb2, .tz2, .tlz, .txz, .tzst) are searched and\n                  matching pathnames of files in archives are output in braces.\n                  When used with option --zmax=NUM, searches the contents of\n                  compressed files and archives stored within archives up to NUM\n                  levels.  When -g, -O, -M, or -t is specified, searches files\n                  stored in archives whose filenames match globs, match filename\n                  extensions, match file signature magic bytes, or match file types,\n                  respectively.  Supported compression formats: gzip (.gz), compress\n                  (.Z), zip, 7z, bzip2 (requires suffix .bz, .bz2, .bzip2, .tbz,\n                  .tbz2, .tb2, .tz2), lzma and xz (requires suffix .lzma, .tlz, .xz,\n                  .txz), lz4 (requires suffix .lz4), zstd (requires suffix .zst,\n                  .zstd, .tzst), brotli (requires suffix .br), bzip3 (requires\n                  suffix .bz3).\n\n           --zmax=NUM\n                  When used with option -z or --decompress, searches the contents of\n                  compressed files and archives stored within archives by up to NUM\n                  expansion stages.  The default --zmax=1 only permits searching\n                  uncompressed files stored in cpio, pax, tar, zip and 7z archives;\n                  compressed files and archives are detected as binary files and are\n                  effectively ignored.  Specify --zmax=2 to search compressed files\n                  and archives stored in cpio, pax, tar, zip and 7z archives.  NUM\n                  may range from 1 to 99 for up to 99 decompression and de-archiving\n                  steps.  Increasing NUM values gradually degrades performance.\n\n    EXIT STATUS\n           The ugrep utility exits with one of the following values:\n\n           0      One or more lines were selected.\n\n           1      No lines were selected.\n\n           \u003e1     An error occurred.\n\n           If -q or --quiet or --silent is used and a line is selected, the exit\n           status is 0 even if an error occurred.\n\n    CONFIGURATION\n           The ug command is intended for context-dependent interactive searching\n           and is equivalent to the ugrep --config --pretty --sort command to load\n           the default configuration file `.ugrep' when present in the working\n           directory or in the home directory.\n\n           A configuration file contains `NAME=VALUE' pairs per line, where `NAME`\n           is the name of a long option (without `--') and `=VALUE' is an argument,\n           which is optional and may be omitted depending on the option.  Empty\n           lines and lines starting with a `#' are ignored.\n\n           The --config=FILE option and its abbreviated form ---FILE load the\n           specified configuration file located in the working directory or, when\n           not found, located in the home directory.  An error is produced when FILE\n           is not found or cannot be read.\n\n           Command line options are parsed in the following order: the configuration\n           file is loaded first, followed by the remaining options and arguments on\n           the command line.\n\n           The --save-config option saves a `.ugrep' configuration file to the\n           working directory with a subset of the options specified on the command\n           line.  The --save-config=FILE option saves the configuration to FILE.\n           The configuration is written to standard output when FILE is a `-'.\n\n    GLOBBING\n           Globbing is used by options -g, --include, --include-dir, --include-from,\n           --exclude, --exclude-dir, --exclude-from and --ignore-files to match\n           pathnames and basenames in recursive searches.  Glob arguments for these\n           options should be quoted to prevent shell globbing.\n\n           Globbing supports gitignore syntax and the corresponding matching rules,\n           except that a glob normally matches files but not directories.  If a glob\n           ends in a path separator `/', then it matches directories but not files,\n           as if --include-dir or --exclude-dir is specified.  When a glob contains\n           a path separator `/', the full pathname is matched.  Otherwise the\n           basename of a file or directory is matched.  For example, *.h matches\n           foo.h and bar/foo.h.  bar/*.h matches bar/foo.h but not foo.h and not\n           bar/bar/foo.h.  Use a leading `/' to force /*.h to match foo.h but not\n           bar/foo.h.\n\n           When a glob starts with a `^' or a `!' as in -g^GLOB, the match is\n           negated.  Likewise, a `!' (but not a `^') may be used with globs in the\n           files specified --include-from, --exclude-from, and --ignore-files to\n           negate the glob match.  Empty lines or lines starting with a `#' are\n           ignored.\n\n           Glob Syntax and Conventions\n\n           *      Matches anything except /.\n\n           ?      Matches any one character except /.\n\n           [abc-e]\n                  Matches one character a,b,c,d,e.\n\n           [^abc-e]\n                  Matches one character not a,b,c,d,e,/.\n\n           [!abc-e]\n                  Matches one character not a,b,c,d,e,/.\n\n           /      When used at the start of a glob, matches if pathname has no /.\n                  When used at the end of a glob, matches directories only.\n\n           **/    Matches zero or more directories.\n\n           /**    When used at the end of a glob, matches everything after the /.\n\n           \\?     Matches a ? or any other character specified after the backslash.\n\n           Glob Matching Examples\n\n           *      Matches a, b, x/a, x/y/b\n\n           a      Matches a, x/a, x/y/a,       but not b, x/b, a/a/b\n\n           /*     Matches a, b,                but not x/a, x/b, x/y/a\n\n           /a     Matches a,                   but not x/a, x/y/a\n\n           a?b    Matches axb, ayb,            but not a, b, ab, a/b\n\n           a[xy]b Matches axb, ayb             but not a, b, azb\n\n           a[a-z]b\n                  Matches aab, abb, acb, azb,  but not a, b, a3b, aAb, aZb\n\n           a[^xy]b\n                  Matches aab, abb, acb, azb,  but not a, b, axb, ayb\n\n           a[^a-z]b\n                  Matches a3b, aAb, aZb        but not a, b, aab, abb, acb, azb\n\n           a/*/b  Matches a/x/b, a/y/b,        but not a/b, a/x/y/b\n\n           **/a   Matches a, x/a, x/y/a,       but not b, x/b.\n\n           a/**/b Matches a/b, a/x/b, a/x/y/b, but not x/a/b, a/b/x\n\n           a/**   Matches a/x, a/y, a/x/y,     but not a, b/x\n\n           a\\?b   Matches a?b,                 but not a, b, ab, axb, a/b\n\n           Note that exclude glob patterns take priority over include glob patterns\n           when specified with options -g, --exclude, --exclude-dir, --include and\n           include-dir.\n\n           Glob patterns specified with prefix `!' in any of the files associated\n           with --include-from, --exclude-from and --ignore-files will negate a\n           previous glob match.  That is, any matching file or directory excluded by\n           a previous glob pattern specified in the files associated with --exclude-\n           from or --ignore-file will become included again.  Likewise, any matching\n           file or directory included by a previous glob pattern specified in the\n           files associated with --include-from will become excluded again.\n\n    ENVIRONMENT\n           GREP_PATH\n                  May be used to specify a file path to pattern files.  The file\n                  path is used by option -f to open a pattern file, when the pattern\n                  file does not exist.\n\n           GREP_COLOR\n                  May be used to specify ANSI SGR parameters to highlight matches\n                  when option --color is used, e.g. 1;35;40 shows pattern matches in\n                  bold magenta text on a black background.  Deprecated in favor of\n                  GREP_COLORS, but still supported.\n\n           GREP_COLORS\n                  May be used to specify ANSI SGR parameters to highlight matches\n                  and other attributes when option --color is used.  Its value is a\n                  colon-separated list of ANSI SGR parameters that defaults to\n                  cx=33:mt=1;31:fn=1;35:ln=1;32:cn=1;32:bn=1;32:se=36 with\n                  additional parameters for TUI colors\n                  :qp=1;32:qe=1;37;41:qm=1;32:ql=36:qb=1;35.  The mt=, ms=, and mc=\n                  capabilities of GREP_COLORS take priority over GREP_COLOR.  Option\n                  --colors takes priority over GREP_COLORS.\n\n    GREP_COLORS\n           Colors are specified as string of colon-separated ANSI SGR parameters of\n           the form `what=substring', where `substring' is a semicolon-separated\n           list of ANSI SGR codes or `k' (black), `r' (red), `g' (green), `y'\n           (yellow), `b' (blue), `m' (magenta), `c' (cyan), `w' (white).  Upper case\n           specifies background colors.  A `+' qualifies a color as bright.  A\n           foreground and a background color may be combined with one or more font\n           properties `n' (normal), `f' (faint), `h' (highlight), `i' (invert), `u'\n           (underline).  Substrings may be specified for:\n\n           sl=    selected lines.\n\n           cx=    context lines.\n\n           rv     swaps the sl= and cx= capabilities when -v is specified.\n\n           mt=    matching text in any matching line.\n\n           ms=    matching text in a selected line.  The substring mt= by default.\n\n           mc=    matching text in a context line.  The substring mt= by default.\n\n           fn=    filenames.\n\n           ln=    line numbers.\n\n           cn=    column numbers.\n\n           bn=    byte offsets.\n\n           se=    separators.\n\n           rv     a Boolean parameter, switches sl= and cx= with option -v.\n\n           hl     a Boolean parameter, enables filename hyperlinks (\\33]8;;link).\n\n           ne     a Boolean parameter, disables ``erase in line'' \\33[K.\n\n           qp=    TUI prompt.\n\n           qe=    TUI errors.\n\n           qr=    TUI regex.\n\n           qm=    TUI regex meta characters.\n\n           ql=    TUI regex lists and literals.\n\n           qb=    TUI regex braces.\n\n    FORMAT\n           Option --format=FORMAT specifies an output format for file matches.\n           Fields may be used in FORMAT, which expand into the following values:\n\n           %[TEXT]F\n                  if option -H is used: TEXT, the file pathname and separator.\n\n           %f     the file pathname.\n\n           %a     the file basename without directory path.\n\n           %p     the directory path to the file.\n\n           %z     the file pathname in a (compressed) archive.\n\n           %[TEXT]H\n                  if option -H is used: TEXT, the quoted pathname and separator, \\\"\n                  and \\\\ replace \" and \\.\n\n           %h     the quoted file pathname, \\\" and \\\\ replace \" and \\.\n\n           %[TEXT]I\n                  if option -H is used: TEXT, the pathname as XML character data and\n                  separator.\n\n           %i     the file pathname as XML character data.\n\n           %[TEXT]N\n                  if option -n is used: TEXT, the line number and separator.\n\n           %n     the line number of the match.\n\n           %[TEXT]K\n                  if option -k is used: TEXT, the column number and separator.\n\n           %k     the column number of the match.\n\n           %[TEXT]B\n                  if option -b is used: TEXT, the byte offset and separator.\n\n           %b     the byte offset of the match.\n\n           %[TEXT]T\n                  if option -T is used: TEXT and a tab character.\n\n           %t     a tab character.\n\n           %[SEP]$\n                  set field separator to SEP for the rest of the format fields.\n\n           %[TEXT]\u003c\n                  if the first match: TEXT.\n\n           %[TEXT]\u003e\n                  if not the first match: TEXT.\n\n           %,     if not the first match: a comma, same as %[,]\u003e.\n\n           %:     if not the first match: a colon, same as %[:]\u003e.\n\n           %;     if not the first match: a semicolon, same as %[;]\u003e.\n\n           %|     if not the first match: a vertical bar, same as %[|]\u003e.\n\n           %[TEXT]S\n                  if not the first match: TEXT and separator, see also %[SEP]$.\n\n           %s     the separator, see also %[TEXT]S and %[SEP]$.\n\n           %~     a newline character.\n\n           %M     the number of matching lines\n\n           %m     the number of matches\n\n           %O     the matching line is output as a raw string of bytes.\n\n           %o     the match is output as a raw string of bytes.\n\n           %Q     the matching line as a quoted string, \\\" and \\\\ replace \" and \\.\n\n           %q     the match as a quoted string, \\\" and \\\\ replace \" and \\.\n\n           %C     the matching line formatted as a quoted C/C++ string.\n\n           %c     the match formatted as a quoted C/C++ string.\n\n           %J     the matching line formatted as a quoted JSON string.\n\n           %j     the match formatted as a quoted JSON string.\n\n           %V     the matching line formatted as a quoted CSV string.\n\n           %v     the match formatted as a quoted CSV string.\n\n           %X     the matching line formatted as XML character data.\n\n           %x     the match formatted as XML character data.\n\n           %w     the width of the match, counting wide characters.\n\n           %d     the size of the match, counting bytes.\n\n           %e     the ending byte offset of the match.\n\n           %Z     the edit distance cost of an approximate match with option -Z\n\n           %u     select unique lines only, unless option -u is used.\n\n           %1     the first regex group capture of the match, and so on up to group\n                  %9, same as %[1]#; requires option -P.\n\n           %[NUM]#\n                  the regex group capture NUM; requires option -P.\n\n           %[NUM]b\n                  the byte offset of the group capture NUM; requires option -P.  Use\n                  e for the ending byte offset and d for the byte length.\n\n           %[NUM1|NUM2|...]#\n                  the first group capture NUM that matched; requires option -P.\n\n           %[NUM1|NUM2|...]b\n                  the byte offset of the first group capture NUM that matched;\n                  requires option -P.  Use e for the ending byte offset and d for\n                  the byte length.\n\n           %[NAME]#\n                  the NAMEd group capture; requires option -P and capturing pattern\n                  `(?\u003cNAME\u003ePATTERN)', see also %G.\n\n           %[NAME]b\n                  the byte offset of the NAMEd group capture; requires option -P and\n                  capturing pattern `(?\u003cNAME\u003ePATTERN)'.  Use e for the ending byte\n                  offset and d for the byte length.\n\n           %[NAME1|NAME2|...]#\n                  the first NAMEd group capture that matched; requires option -P and\n                  capturing pattern `(?\u003cNAME\u003ePATTERN)', see also %G.\n\n           %[NAME1|NAME2|...]b\n                  the byte offset of the first NAMEd group capture that matched;\n                  requires option -P and capturing pattern `(?\u003cNAME\u003ePATTERN)'.  Use\n                  e for the ending byte offset and d for the byte length.\n\n           %G     list of group capture indices/names that matched; requires option\n                  -P.\n\n           %[TEXT1|TEXT2|...]G\n                  list of TEXT indexed by group capture indices that matched;\n                  requires option -P.\n\n           %g     the group capture index/name matched or 1; requires option -P.\n\n           %[TEXT1|TEXT2|...]g\n                  the first TEXT indexed by the first group capture index that\n                  matched; requires option -P.\n\n           %%     the percentage sign.\n\n           Formatted output is written without a terminating newline, unless %~ or\n           `\\n' is explicitly specified in the format string.\n\n           The [TEXT] part of a field is optional and may be omitted.  When present,\n           the argument must be placed in [] brackets, for example %[,]F to output a\n           comma, the pathname, and a separator.\n\n           %[SEP]$ and %u are switches and do not send anything to the output.\n\n           The separator used by the %F, %H, %I, %N, %K, %B, %S and %G fields may be\n           changed by preceding the field by %[SEP]$.  When [SEP] is not provided,\n           this reverts the separator to the default separator or the separator\n           specified with --separator.\n\n           Formatted output is written for each matching pattern, which means that a\n           line may be output multiple times when patterns match more than once on\n           the same line.  If field %u is specified anywhere in a format string,\n           matching lines are output only once, unless option -u, --ungroup is\n           specified or when more than one line of input matched the search pattern.\n\n           Additional formatting options:\n\n           --format-begin=FORMAT\n                  the FORMAT when beginning the search.\n\n           --format-open=FORMAT\n                  the FORMAT when opening a file and a match was found.\n\n           --format-close=FORMAT\n                  the FORMAT when closing a file and a match was found.\n\n           --format-end=FORMAT\n                  the FORMAT when ending the search.\n\n           The context options -A, -B, -C, -y, and display options --break,\n           --heading, --color, -T, and --null have no effect on formatted output.\n\n    EXAMPLES\n           Display lines containing the word `patricia' in `myfile.txt':\n\n                  $ ugrep -w patricia myfile.txt\n\n           Display lines containing the word `patricia', ignoring case:\n\n                  $ ugrep -wi patricia myfile.txt\n\n           Display lines approximately matching the word `patricia', ignoring case\n           and allowing up to 2 spelling errors using fuzzy search:\n\n                  $ ugrep -Z2 -wi patricia myfile.txt\n\n           Count the number of lines containing `patricia', ignoring case:\n\n                  $ ugrep -cwi patricia myfile.txt\n\n           Count the number of words `patricia', ignoring case:\n\n                  $ ugrep -cowi patricia myfile.txt\n\n           List lines with `amount' and a decimal, ignoring case (space is AND):\n\n                  $ ugrep -i -% 'amount +(.+)?' myfile.txt\n\n           Alternative query:\n\n                  $ ugrep -wi -e amount --and '+(.+)?' myfile.txt\n\n           List all Unicode words in a file:\n\n                  $ ugrep -o '\\w+' myfile.txt\n\n           List the laughing face emojis (Unicode code points U+1F600 to U+1F60F):\n\n                  $ ugrep -o '[\\x{1F600}-\\x{1F60F}]' myfile.txt\n\n           Check if a file contains any non-ASCII (i.e. Unicode) characters:\n\n                  $ ugrep -q '[^[:ascii:]]' myfile.txt \u0026\u0026 echo \"contains Unicode\"\n\n           Display the line and column number of `FIXME' in C++ files using\n           recursive search, with one line of context before and after a matched\n           line:\n\n                  $ ugrep -C1 -R -n -k -tc++ FIXME\n\n           Display the line and column number of `FIXME' in long Javascript files\n           using recursive search, showing only matches with up to 10 characters of\n           context before and after:\n\n                  $ ugrep -o -C20 -R -n -k -tjs FIXME\n\n\n           Find blocks of text between lines matching BEGIN and END by using a lazy\n           quantifier `*?' to match only what is necessary and pattern `\\n' to match\n           newlines:\n\n                  $ ugrep -n 'BEGIN.*\\n(.*\\n)*?.*END' myfile.txt\n\n           Likewise, list the C/C++ comments in a file and line numbers:\n\n                  $ ugrep -n -e '//.*' -e '/\\*(.*\\n)*?.*\\*+\\/' myfile.cpp\n\n           The same, but using predefined pattern c++/comments:\n\n                  $ ugrep -n -f c++/comments myfile.cpp\n\n           List the lines that need fixing in a C/C++ source file by looking for the\n           word `FIXME' while skipping any `FIXME' in quoted strings:\n\n                  $ ugrep -e FIXME -N '\"(\\\\.|\\\\\\r?\\n|[^\\\\\\n\"])*\"' myfile.cpp\n\n           The same, but using predefined pattern cpp/zap_strings:\n\n                  $ ugrep -e FIXME -f cpp/zap_strings myfile.cpp\n\n           Find lines with `FIXME' or `TODO', showing line numbers:\n\n                  $ ugrep -n -e FIXME -e TODO myfile.cpp\n\n           Find lines with `FIXME' that also contain `urgent':\n\n                  $ ugrep -n -e FIXME --and urgent myfile.cpp\n\n           The same, but with a Boolean query pattern (a space is AND):\n\n                  $ ugrep -n -% 'FIXME urgent' myfile.cpp\n\n           Find lines with `FIXME' that do not also contain `later':\n\n                  $ ugrep -n -e FIXME --andnot later myfile.cpp\n\n           The same, but with a Boolean query pattern (a space is AND, - is NOT):\n\n                  $ ugrep -n -% 'FIXME -later' myfile.cpp\n\n           Output a list of line numbers of lines with `FIXME' but not `later':\n\n                  $ ugrep -e FIXME --andnot later --format='%,%n' myfile.cpp\n\n           Recursively list all files with both `FIXME' and `LICENSE' anywhere in\n           the file, not necessarily on the same line:\n\n                  $ ugrep -l -%% 'FIXME LICENSE'\n\n           Find lines with `FIXME' in the C/C++ files stored in a tarball:\n\n                  $ ugrep -z -tc++ -n FIXME project.tgz\n\n           Recursively find lines with `FIXME' in C/C++ files, but do not search any\n           `bak' and `old' directories:\n\n                  $ ugrep -n FIXME -tc++ -g^bak/,^old/\n\n           Recursively search for the word `copyright' in cpio, jar, pax, tar, zip,\n           7z archives, compressed and regular files, and in PDFs using a PDF\n           filter:\n\n                  $ ugrep -z -w --filter='pdf:pdftotext % -' copyright\n\n           Match the binary pattern `A3hhhhA3' (hex) in a binary file without\n           Unicode pattern matching -U (which would otherwise match `\\xaf' as a\n           Unicode character U+00A3 with UTF-8 byte sequence C2 A3) and display the\n           results in hex with --hexdump with C1 to output one hex line before and\n           after each match:\n\n                  $ ugrep -U --hexdump=C1 '\\xa3[\\x00-\\xff]{2}\\xa3' a.out\n\n           Hexdump an entire file using a pager for viewing:\n\n                  $ ugrep -X --pager '' a.out\n\n           List all files that are not ignored by one or more `.gitignore':\n\n                  $ ugrep -l '' --ignore-files\n\n           List all files containing a RPM signature, located in the `rpm' directory\n           and recursively below up to two levels deeper (3 levels total):\n\n                  $ ugrep -3 -l -tRpm '' rpm/\n\n           Monitor the system log for bug reports and ungroup multiple matches on a\n           line:\n\n                  $ tail -f /var/log/system.log | ugrep -u -i -w bug\n\n           Interactive fuzzy search with Boolean search queries:\n\n                  $ ugrep -Q -l -% -Z3 --sort=best\n\n           Display all words in a MacRoman-encoded file that has CR newlines:\n\n                  $ ugrep --encoding=MACROMAN '\\w+' mac.txt\n\n           Display options related to \"fuzzy\" searching:\n\n                  $ ugrep --help fuzzy\n\n    COPYRIGHT\n           Copyright (c) 2021,2025 Robert A. van Engelen \u003cengelen@acm.org\u003e\n\n           ugrep is released under the BSD-3 license.  All parts of the software\n           have reasonable copyright terms permitting free redistribution.  This\n           includes the ability to reuse all or parts of the ugrep source tree.\n\n    SEE ALSO\n           ugrep-indexer(1), grep(1), zgrep(1).\n\n    BUGS\n           Report bugs at: \u003chttps://github.com/Genivia/ugrep/issues\u003e\n\n\n\n    ugrep 7.2.2                     February 3, 2025                        UGREP(1)\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"patterns\"/\u003e\n\nRegex patterns\n--------------\n\nFor PCRE regex patterns with option `-P`, please see the PCRE documentation\n\u003chttps://www.pcre.org/original/doc/html/pcrepattern.html\u003e.  The pattern syntax\nhas more features than the pattern syntax described below.  For the patterns in\ncommon the syntax and meaning are the same.\n\nNote that `[[:space:]]` and `\\s` and inverted bracket lists `[^...]` are\nmodified in **ugrep** to prevent matching newlines `\\n`.  This modification is\ndone to replicate the behavior of grep.\n\n\u003ca name=\"posix-syntax\"/\u003e\n\n### POSIX regular expression syntax\n\nAn empty pattern is a special case that matches everything except empty files,\ni.e. does not match zero-length files, as per POSIX.1 grep standard.\n\nA regex pattern is an extended set of regular expressions (ERE), with nested\nsub-expression patterns `φ` and `ψ`:\n\n  Pattern   | Matches\n  --------- | -----------------------------------------------------------------\n  `x`       | matches the character `x`, where `x` is not a special character\n  `.`       | matches any single character except newline (unless in dotall mode)\n  `\\.`      | matches `.` (dot), special characters are escaped with a backslash\n  `\\n`      | matches a newline, others are `\\a` (BEL), `\\b` (BS), `\\t` (HT), `\\v` (VT), `\\f` (FF), and `\\r` (CR)\n  `\\0`      | matches the NUL character\n  `\\cX`     | matches the control character `X` mod 32 (e.g. `\\cA` is `\\x01`)\n  `\\0141`   | matches an 8-bit character with octal value `141`, i.e. `a`\n  `\\x7f`    | matches an 8-bit character with hexadecimal value `7f`\n  `\\x{3B1}` | matches Unicode character U+03B1, i.e. `α`\n  `\\u{3B1}` | matches Unicode character U+03B1, i.e. `α`\n  `\\o{141}` | matches Unicode character U+0061, i.e. `a`, in octal\n  `\\p{C}`   | matches a character in Unicode category C\n  `\\Q...\\E` | matches the quoted content between `\\Q` and `\\E` literally\n  `[abc]`   | matches one of `a`, `b`, or `c`\n  `[0-9]`   | matches a digit `0` to `9`\n  `[^0-9]`  | matches any character except a digit and excluding `\\n`\n  `φ?`      | matches `φ` zero or one time (optional)\n  `φ*`      | matches `φ` zero or more times (repetition)\n  `φ+`      | matches `φ` one or more times (repetition)\n  `φ{2,5}`  | matches `φ` two to five times (repetition)\n  `φ{2,}`   | matches `φ` at least two times (repetition)\n  `φ{2}`    | matches `φ` exactly two times (repetition)\n  `φ??`     | matches `φ` zero or once as needed (lazy optional)\n  `φ*?`     | matches `φ` a minimum number of times as needed (lazy repetition)\n  `φ+?`     | matches `φ` a minimum number of times at least once as needed (lazy repetition)\n  `φ{2,5}?` | matches `φ` two to five times as needed (lazy repetition)\n  `φ{2,}?`  | matches `φ` at least two times or more as needed (lazy repetition)\n  `φψ`      | matches `φ` then matches `ψ` (concatenation)\n  `φ⎮ψ`     | matches `φ` or matches `ψ` (alternation)\n  `(φ)`     | matches `φ` as a group\n  `(?:φ)`   | matches `φ` as a group without capture\n  `(?=φ)`   | matches `φ` without consuming it, i.e. lookahead (without option `-P`: nothing may occur after `(?=φ)`)\n  `(?^φ)`   | matches `φ` and ignores it, marking everything in the pattern as a non-match\n  `^φ`      | matches `φ` at the start of input or start of a line (nothing may occur before `^`)\n  `φ$`      | matches `φ` at the end of input or end of a line (nothing may occur after `$`)\n  `\\Aφ`     | matches `φ` at the start of input (nothing may occur before `\\A`)\n  `φ\\z`     | matches `φ` at the end of input (nothing may occur after `\\z`)\n  `\\bφ`     | matches `φ` starting at a word boundary (without option `-P`: nothing may occur before `\\b`)\n  `φ\\b`     | matches `φ` ending at a word boundary (without option `-P`: nothing may occur after `\\b`)\n  `\\Bφ`     | matches `φ` starting at a non-word boundary (without option `-P`: nothing may occur before `\\B`)\n  `φ\\B`     | matches `φ` ending at a non-word boundary (without option `-P`: nothing may occur after `\\B`)\n  `\\\u003cφ`     | matches `φ` that starts a word (without option `-P`: nothing may occur before `\\\u003c`)\n  `\\\u003eφ`     | matches `φ` that starts a non-word (without option `-P`: nothing may occur before `\\\u003e`)\n  `φ\\\u003c`     | matches `φ` that ends a non-word (without option `-P`: nothing may occur after `\\\u003c`)\n  `φ\\\u003e`     | matches `φ` that ends a word (without option `-P`: nothing may occur after `\\\u003e`)\n  `(?i:φ)`  | matches `φ` ignoring case\n  `(?s:φ)`  | `.` (dot) in `φ` matches newline\n  `(?x:φ)`  | ignore all whitespace and comments in `φ`\n  `(?#:X)`  | all of `X` is skipped as a comment\n\nThe order of precedence for composing larger patterns from sub-patterns is as\nfollows, from high to low precedence:\n\n  1. Characters, character classes (bracket expressions), escapes, quotation\n  2. Grouping `(φ)`, `(?:φ)`, `(?=φ)`, and inline modifiers `(?imsux:φ)`\n  3. Quantifiers `?`, `*`, `+`, `{n,m}`\n  4. Concatenation `φψ`\n  5. Anchoring `^`, `$`, `\\\u003c`, `\\\u003e`, `\\b`, `\\B`, `\\A`, `\\z`\n  6. Alternation `φ|ψ`\n  7. Global modifiers `(?imsux)φ`\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"posix-classes\"/\u003e\n\n### POSIX and Unicode character classes\n\nCharacter classes in bracket lists represent sets of characters.  Sets can be\nnegated (inverted), subtracted, intersected, and merged (not supported by PCRE2\nwith option `-P`):\n\n  Pattern           | Matches\n  ----------------- | ---------------------------------------------------------\n  `[a-zA-Z]`        | matches a letter\n  `[^a-zA-Z]`       | matches a non-letter (character class negation), newlines are not matched\n  `[a-z−−[aeiou]]`  | matches a consonant (character class subtraction)\n  `[a-z\u0026\u0026[^aeiou]]` | matches a consonant (character class intersection)\n  `[a-z⎮⎮[A-Z]]`    | matches a letter (character class union)\n\nBracket lists cannot be empty, so `[]` and `[^]` are invalid.  In fact, the\nfirst character after the bracket is always part of the list.  So `[][]` is a\nlist that matches a `]` and a `[`, `[^][]` is a list that matches anything but\n`]` and `[`, and `[-^]` is a list that matches a `-` and a `^`.\n\nNegated character classes such as `[^a-z]` do not match newlines for\ncompatibility with traditional grep pattern matching.\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"posix-categories\"/\u003e\n\n### POSIX and Unicode character categories\n\nThe POSIX form can only be used in bracket lists, for example\n`[[:lower:][:digit:]]` matches an ASCII lower case letter or a digit.\n\nYou can also use the `\\p{C}` form for class `C` and upper case `\\P{C}` form\nthat has the same meaning as `\\p{^C}`, which matches any character except\ncharacters in the class `C`.  For example, `\\P{ASCII}` is the same as\n`\\p{^ASCII}` which is the same as `[[:^ascii]]`.\n\n  POSIX form   | Matches\n  ------------ | ---------------------------------------------\n  `[:ascii:]`  | matches an ASCII character U+0000 to U+007F including `\\n`\n  `[:space:]`  | matches a white space character `[ \\t\\v\\f\\r]` excluding `\\n`\n  `[:xdigit:]` | matches a hex digit `[0-9A-Fa-f]`\n  `[:cntrl:]`  | matches a control character `[\\x00-\\t\\x0b-\\x1f\\x7f]` excluding `\\n`\n  `[:print:]`  | matches a printable character `[\\x20-\\x7e]`\n  `[:alnum:]`  | matches a alphanumeric character `[0-9A-Za-z]`\n  `[:alpha:]`  | matches a letter `[A-Za-z]`\n  `[:blank:]`  | matches a blank character `\\h` same as `[ \\t]`\n  `[:digit:]`  | matches a digit `[0-9]`\n  `[:graph:]`  | matches a visible character `[\\x21-\\x7e]`\n  `[:lower:]`  | matches a lower case letter `[a-z]`\n  `[:punct:]`  | matches a punctuation character `[\\x21-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7e]`\n  `[:upper:]`  | matches an upper case letter `[A-Z]`\n  `[:word:]`   | matches a word character `[0-9A-Za-z_]`\n  `[:^blank:]` | matches a non-blank characater `\\H` same as `[^ \\t]`\n  `[:^digit:]` | matches a non-digit `[^0-9]`\n\nPOSIX character categories only cover ASCII, `[[:^ascii]]` is empty and\ntherefore invalid to use.  By contrast, `[^[:ascii]]` is a Unicode character\nclass that excludes the ASCII character category.\n\nNote that the patterns `[[:ascii:]]` and negated classes such as `[[:^digit:]]`\nmatch newlines, which is the official definition of these POSIX categories.  By\ncontrast, GNU/BSD grep never match newlines.  As a consequence, more patterns\nmay match.\n\nNegated character classes of the form `[^...]` match any Unicode character\nexcept the given characters and does not match newlines either.  For example\n`[^[:digit:]]` matches non-digits (including Unicode) and does not match\nnewlines.  By contrast, `[[:^digit:]]` matches ASCII non-digits, including\nnewlines.\n\nOption `-U` disables Unicode wide-character matching, i.e. ASCII matching.\n\n  Unicode category                       | Matches\n  -------------------------------------- | ------------------------------------\n  `.`                                    | matches any single Unicode character except newline `\\n` unless with `--dotall`\n  `\\a`                                   | matches BEL U+0007\n  `\\d`                                   | matches a digit `[0-9]` or `\\p{Nd}`\n  `\\D`                                   | matches a non-digit including `\\n`\n  `\\e`                                   | matches ESC U+001b\n  `\\f`                                   | matches FF U+000c\n  `\\h`                                   | matches a blank `[ \\t]`\n  `\\H`                                   | matches a non-blank `[^ \\t]` including `\\n`\n  `\\l`                                   | matches a lower case letter `\\p{Ll}`\n  `\\n`                                   | matches LF U+000a\n  `\\N`                                   | matches a non-LF character\n  `\\r`                                   | matches CR U+000d\n  `\\R`                                   | matches a Unicode line break (`\\r\\n`, `\\r`, `\\v`, `\\f`, `\\n`, U+0085, U+2028 and U+2029)\n  `\\s`                                   | matches a white space character `[ \\t\\v\\f\\r\\x85\\p{Z}]` excluding `\\n`\n  `\\S`                                   | matches a non-white space character and excluding `\\n`\n  `\\t`                                   | matches TAB U+0009\n  `\\u`                                   | matches an upper case letter `\\p{Lu}`\n  `\\v`                                   | matches VT U+000b or vertical space character with option `-P`\n  `\\w`                                   | matches a word character `[0-9A-Za-z_]` or `[\\p{L}\\p{Nd}\\p{Pc}]`\n  `\\W`                                   | matches a non-Unicode word character including `\\n`\n  `\\X`                                   | matches any ISO-8859-1 or Unicode character including `\\n`\n  `\\p{Space}`                            | matches a white space character `[ \\t\\v\\f\\r\\x85\\p{Z}]` excluding `\\n`\n  `\\p{Unicode}`                          | matches any Unicode character U+0000 to U+10FFFF minus U+D800 to U+DFFF\n  `\\p{ASCII}`                            | matches an ASCII character U+0000 to U+007F including `\\n`\n  `\\p{Non_ASCII_Unicode}`                | matches a non-ASCII character U+0080 to U+10FFFF minus U+D800 to U+DFFF\n  `\\p{L\u0026}`                               | matches a character with Unicode property L\u0026 (i.e. property Ll, Lu, or Lt)\n  `\\p{Letter}`,`\\p{L}`                   | matches a character with Unicode property Letter\n  `\\p{Mark}`,`\\p{M}`                     | matches a character with Unicode property Mark\n  `\\p{Separator}`,`\\p{Z}`                | matches a character with Unicode property Separator\n  `\\p{Symbol}`,`\\p{S}`                   | matches a character with Unicode property Symbol\n  `\\p{Number}`,`\\p{N}`                   | matches a character with Unicode property Number\n  `\\p{Punctuation}`,`\\p{P}`              | matches a character with Unicode property Punctuation\n  `\\p{Other}`,`\\p{C}`                    | matches a character with Unicode property Other\n  `\\p{Lowercase_Letter}`, `\\p{Ll}`       | matches a character with Unicode sub-property Ll\n  `\\p{Uppercase_Letter}`, `\\p{Lu}`       | matches a character with Unicode sub-property Lu\n  `\\p{Titlecase_Letter}`, `\\p{Lt}`       | matches a character with Unicode sub-property Lt\n  `\\p{Modifier_Letter}`, `\\p{Lm}`        | matches a character with Unicode sub-property Lm\n  `\\p{Other_Letter}`, `\\p{Lo}`           | matches a character with Unicode sub-property Lo\n  `\\p{Non_Spacing_Mark}`, `\\p{Mn}`       | matches a character with Unicode sub-property Mn\n  `\\p{Spacing_Combining_Mark}`, `\\p{Mc}` | matches a character with Unicode sub-property Mc\n  `\\p{Enclosing_Mark}`, `\\p{Me}`         | matches a character with Unicode sub-property Me\n  `\\p{Space_Separator}`, `\\p{Zs}`        | matches a character with Unicode sub-property Zs\n  `\\p{Line_Separator}`, `\\p{Zl}`         | matches a character with Unicode sub-property Zl\n  `\\p{Paragraph_Separator}`, `\\p{Zp}`    | matches a character with Unicode sub-property Zp\n  `\\p{Math_Symbol}`, `\\p{Sm}`            | matches a character with Unicode sub-property Sm\n  `\\p{Currency_Symbol}`, `\\p{Sc}`        | matches a character with Unicode sub-property Sc\n  `\\p{Modifier_Symbol}`, `\\p{Sk}`        | matches a character with Unicode sub-property Sk\n  `\\p{Other_Symbol}`, `\\p{So}`           | matches a character with Unicode sub-property So\n  `\\p{Decimal_Digit_Number}`, `\\p{Nd}`   | matches a character with Unicode sub-property Nd\n  `\\p{Letter_Number}`, `\\p{Nl}`          | matches a character with Unicode sub-property Nl\n  `\\p{Other_Number}`, `\\p{No}`           | matches a character with Unicode sub-property No\n  `\\p{Dash_Punctuation}`, `\\p{Pd}`       | matches a character with Unicode sub-property Pd\n  `\\p{Open_Punctuation}`, `\\p{Ps}`       | matches a character with Unicode sub-property Ps\n  `\\p{Close_Punctuation}`, `\\p{Pe}`      | matches a character with Unicode sub-property Pe\n  `\\p{Initial_Punctuation}`, `\\p{Pi}`    | matches a character with Unicode sub-property Pi\n  `\\p{Final_Punctuation}`, `\\p{Pf}`      | matches a character with Unicode sub-property Pf\n  `\\p{Connector_Punctuation}`, `\\p{Pc}`  | matches a character with Unicode sub-property Pc\n  `\\p{Other_Punctuation}`, `\\p{Po}`      | matches a character with Unicode sub-property Po\n  `\\p{Control}`, `\\p{Cc}`                | matches a character with Unicode sub-property Cc\n  `\\p{Format}`, `\\p{Cf}`                 | matches a character with Unicode sub-property Cf\n  `\\p{UnicodeIdentifierStart}`           | matches a character in the Unicode IdentifierStart class\n  `\\p{UnicodeIdentifierPart}`            | matches a character in the Unicode IdentifierPart class\n  `\\p{IdentifierIgnorable}`              | matches a character in the IdentifierIgnorable class\n  `\\p{JavaIdentifierStart}`              | matches a character in the Java IdentifierStart class\n  `\\p{JavaIdentifierPart}`               | matches a character in the Java IdentifierPart class\n  `\\p{CsIdentifierStart}`                | matches a character in the C# IdentifierStart class\n  `\\p{CsIdentifierPart}`                 | matches a character in the C# IdentifierPart class\n  `\\p{PythonIdentifierStart}`            | matches a character in the Python IdentifierStart class\n  `\\p{PythonIdentifierPart}`             | matches a character in the Python IdentifierPart class\n\nTo specify a Unicode block as a category use `\\p{IsBlockName}` with a Unicode\n`BlockName`.\n\nTo specify a Unicode language script, use `\\p{Language}` with a Unicode\n`Language`.\n\nUnicode language script character classes differ from the Unicode blocks that\nhave a similar name.  For example, the `\\p{Greek}` class represents Greek and\nCoptic letters and differs from the Unicode block `\\p{IsGreek}` that spans a\nspecific Unicode block of Greek and Coptic characters only, which also includes\nunassigned characters.\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"perl-syntax\"/\u003e\n\n### Perl regular expression syntax\n\nFor the pattern syntax of **ugrep** option `-P` (Perl regular expressions), see\nfor example [Perl regular expression syntax](https://www.boost.org/doc/libs/1_70_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html).\nHowever, **ugrep** enhances the Perl regular expression syntax with all of the\nfeatures listed in [POSIX regular expression syntax](#posix-syntax).\n\n🔝 [Back to table of contents](#toc)\n\n\u003ca name=\"bugs\"/\u003e\n\nTroubleshooting\n---------------\n\nIf something is not working, then please check the [tutorial](#tutorial) and\nthe [man page](#man).  If you can't find it there and it looks like a bug, then\n[report an issue](https://github.com/Genivia/ugrep/issues) on GitHub.  Bug\nreports are quickly addressed.\n\n*Copyright (c) Robert van Engelen, 2025*\n\n","funding_links":[],"categories":["C++","tui","\u003ca name=\"cpp\"\u003e\u003c/a\u003eC++","Grep Replacement","\u003ca name=\"text-search\"\u003e\u003c/a\u003eText search (alternatives to grep)","Other"],"sub_categories":["Open USP Tsukubai"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGenivia%2Fugrep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGenivia%2Fugrep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGenivia%2Fugrep/lists"}