{"id":13605702,"url":"https://github.com/gvansickle/ucg","last_synced_at":"2025-10-21T04:54:57.933Z","repository":{"id":56781628,"uuid":"41645766","full_name":"gvansickle/ucg","owner":"gvansickle","description":"UniversalCodeGrep (ucg) is an extremely fast grep-like tool specialized for searching large bodies of source code.","archived":false,"fork":false,"pushed_at":"2024-12-28T02:49:04.000Z","size":5586,"stargazers_count":137,"open_issues_count":25,"forks_count":18,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-09-26T14:14:12.036Z","etag":null,"topics":["ack","grep","pcre2","ripgrep","silver-searcher"],"latest_commit_sha":null,"homepage":"https://gvansickle.github.io/ucg/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gvansickle.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-08-30T22:58:38.000Z","updated_at":"2025-05-20T12:02:48.000Z","dependencies_parsed_at":"2024-01-21T00:28:53.610Z","dependency_job_id":"9f2b4d8c-4824-4423-b099-610ab536bcf3","html_url":"https://github.com/gvansickle/ucg","commit_stats":{"total_commits":1634,"total_committers":10,"mean_commits":163.4,"dds":0.02631578947368418,"last_synced_commit":"cbb185e8adad6546b7e1c5e9ca59a81f98dca49f"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/gvansickle/ucg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvansickle%2Fucg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvansickle%2Fucg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvansickle%2Fucg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvansickle%2Fucg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gvansickle","download_url":"https://codeload.github.com/gvansickle/ucg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvansickle%2Fucg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280207203,"owners_count":26290616,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ack","grep","pcre2","ripgrep","silver-searcher"],"created_at":"2024-08-01T19:01:01.784Z","updated_at":"2025-10-21T04:54:57.905Z","avatar_url":"https://github.com/gvansickle.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# UniversalCodeGrep\n\n[![License](https://img.shields.io/badge/License-GPL3-red.svg)](COPYING)\n[![Travis-CI Build Status](https://travis-ci.org/gvansickle/ucg.svg?branch=master)](https://travis-ci.org/gvansickle/ucg)\n\u003ca href=\"https://scan.coverity.com/projects/gvansickle-ucg\"\u003e\n  \u003cimg alt=\"Coverity Scan Build Status\"\n       src=\"https://scan.coverity.com/projects/7451/badge.svg\"/\u003e\n\u003c/a\u003e\n\nUniversalCodeGrep (ucg) is an extremely fast grep-like tool specialized for searching large bodies of source code.\n\n## Table of Contents\n\n* [Introduction](#introduction)\n  * [Speed](#speed)\n    * [Benchmark: '\\#include\\\\s\\+\"\\.\\*\"' on Boost source](#benchmark-includes-on-boost-source)\n* [License](#license)\n* [Installation](#installation)\n  * [Fedora Copr Repository](#fedora-copr-repository)\n  * [Arch Linux User Repository](#arch-linux-user-repository)\n  * [OS X](#os-x)\n  * [Building the Source Tarball](#building-the-source-tarball)\n    * [\\*BSD Note](#bsd-note)\n    * [Build Prerequisites](#build-prerequisites)\n      * [gcc and g\\+\\+ versions 4\\.8 or greater\\.](#gcc-and-g-versions-48-or-greater)\n      * [PCRE: libpcre2\\-8 version 10\\.20 or greater, or libpcre version 8\\.21 or greater\\.](#pcre-libpcre2-8-version-1020-or-greater-or-libpcre-version-821-or-greater)\n    * [OS X Prerequisites](#os-x-prerequisites)\n  * [Supported OSes and Distributions](#supported-oses-and-distributions)\n* [Usage](#usage)\n  * [Command Line Options](#command-line-options)\n    * [Searching](#searching)\n    * [Search Output](#search-output)\n    * [File presentation](#file-presentation)\n    * [File/directory inclusion/exclusion:](#filedirectory-inclusionexclusion)\n    * [File type specification:](#file-type-specification)\n    * [Performance Tuning:](#performance-tuning)\n    * [Miscellaneous:](#miscellaneous)\n    * [Informational options:](#informational-options)\n* [Configuration (\\.ucgrc) Files](#configuration-ucgrc-files)\n  * [Format](#format)\n  * [Location and Read Order](#location-and-read-order)\n* [User\\-Defined File Types](#user-defined-file-types)\n  * [Extension List Filter](#extension-list-filter)\n  * [Literal Filename Filter](#literal-filename-filter)\n  * [Glob filter](#glob-filter)\n* [Author](#author)\n\n\u003c!-- TOC Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc.go) --\u003e\n\n\n## Introduction\n\nUniversalCodeGrep (`ucg`) is an extremely fast grep-like tool specialized for searching large bodies of source code.  It is intended to be largely command-line compatible with [`Ack`](http://beyondgrep.com/), to some extent with [`ag`](http://geoff.greer.fm/ag/), and where appropriate with `grep`.  Search patterns are specified as PCRE regexes.\n\n### Speed\n`ucg` is intended to address the impatient programmer's code searching needs.  `ucg` is written in C++20 and takes advantage of the concurrency (and other) support of the language to increase scanning speed while reducing reliance on third-party libraries and increasing portability.  Regex scanning is provided by the [PCRE2 library](http://www.pcre.org/), with its [JIT compilation feature](http://www.pcre.org/current/doc/html/pcre2jit.html) providing a huge performance gain on most platforms.  Directory tree traversal is performed by multiple threads, reducing the impact of waiting for I/O completions.  Critical functions are implemented with hand-rolled vectorized (SSE2/4.2/etc.) versions selected at program load-time based on what the system supports, with non-vectorized fallbacks.\n\nAs a consequence of its overall design for maximum concurrency and speed, `ucg` is extremely fast.  As an example, under Fedora 25, one of the benchmarks in the test suite which scans the Boost 1.58.0 source tree with `ucg` and a selection of similar utilities yields the following results:\n\n#### Benchmark: '#include\\s+\".*\"' on Boost source\n\n| Command | Program Version | Elapsed Real Time, Average of 10 Runs | Num Matched Lines | Num Diff Chars |\n|---------|-----------------|---------------------------------------|-------------------|----------------|\n| `/usr/bin/ucg --noenv --cpp '#include\\s+.*' ~/src/boost_1_58_0` | 0.3.0 | 0.228973 | 9511 | 189 |\n| `/usr/bin/rg -Lun -t cpp '#include\\s+.*' ~/src/boost_1_58_0` | 0.2.9 | 0.167586 | 9509 | 0 |\n| `/usr/bin/ag  --cpp '#include\\s+.*' ~/src/boost_1_58_0` | 0.32.0 | 2.29074 | 9511 | 189 |\n| `grep -Ern --color --include=\\*.cpp --include=\\*.hpp --include=\\*.h --include=\\*.cc --include=\\*.cxx '#include\\s+.*' ~/src/boost_1_58_0` | grep (GNU grep) 2.26 | 0.370082 | 9509 | 0 |\n\nNote that UniversalCodeGrep is in fact somewhat faster than `grep` itself, even when `grep` is only using [Extended Regular Expressions](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04).  And `ucg` certainly wins the ease-of-use contest.\n\n## License\n\n[GPL (Version 3 only)](https://github.com/gvansickle/ucg/blob/master/COPYING)\n\n## Installation\n\nUniversalCodeGrep packages are currently available for Fedora 23/24/25/26, Arch Linux, and OS X.\n\n\u003c!-- COMING SOON\n### Ubuntu PPA\n\nIf you are a Ubuntu user, the easiest way to install UniversalCodeGrep is from the Launchpad PPA [here](https://launchpad.net/~grvs/+archive/ubuntu/ucg).  To install from the command line:\n\n```sh\n# Add the PPA to your system:\nsudo add-apt-repository ppa:grvs/ucg\n# Pull down the latest lists of software from all archives:\nsudo apt-get update\n# Install ucg:\nsudo apt-get install universalcodegrep\n```\n--\u003e\n\n### Fedora Copr Repository\n\nIf you are a Fedora user, the easiest way to install UniversalCodeGrep is from the Fedora Copr-hosted dnf/yum repository [here](https://copr.fedoraproject.org/coprs/grvs/UniversalCodeGrep).  Installation is as simple as:\n\n```sh\n# Add the Copr repo to your system:\nsudo dnf copr enable grvs/UniversalCodeGrep\n# Install UniversalCodeGrep:\nsudo dnf install universalcodegrep\n```\n\n### Arch Linux User Repository\n\nIf you are a Arch Linux user, the easiest way to install UniversalCodeGrep is from the Arch Linux User Repository (AUR) [here](https://aur.archlinux.org/packages/ucg/).  Installation is as simple as:\n\n```sh\n# Install using yaourt:\nyaourt -S ucg\n```\nOr you can install manually:\n```sh\n# Install manually:\ncd /tmp/\ncurl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/ucg.tar.gz\ntar -xvf ucg.tar.gz\ncd ycg\nmakepkg -sri\n```\n\u003c!-- COMING SOON\n\n### openSUSE Binary RPMs\n\nBinary RPMs for openSUSE are available [here](https://github.com/gvansickle/ucg/releases/tag/0.3.3).\n\n--\u003e\n\n### OS X\n\n`ucg` has been accepted into `homebrew-core`, so installing it is as easy as:\n\n```sh\nbrew install ucg\n```\n\n### Building the Source Tarball\n\nIf a `ucg` package is not available for your platform, UniversalCodeGrep can be built and installed from the distribution tarball (available [here](https://github.com/gvansickle/ucg/releases/download/0.3.3/universalcodegrep-0.3.3.tar.gz)) in the standard autotools manner:\n\n```sh\ntar -xaf universalcodegrep-0.3.3.tar.gz\ncd universalcodegrep-0.3.3\n./configure\nmake\nmake install\n```\n\nThis will install the `ucg` executable in `/usr/local/bin`.  If you wish to install it elsewhere or don't have permissions on `/usr/local/bin`, specify an installation prefix on the `./configure` command line:\n\n```sh\n./configure --prefix=~/\u003cinstall-root-dir\u003e\n```\n\n\u003e #### *BSD Note\n\u003e\n\u003e On at least PC-BSD 10.3, g++48 can't find its own libstdc++ without a little help.  Configure the package like this:\n\u003e ```sh\n\u003e ./configure LDFLAGS='-Wl,-rpath=/usr/local/lib/gcc48'\n\u003e ```\n\n#### Build Prerequisites\n\n##### `gcc` and `g++` versions 4.8 or greater.\n\nVersions of `gcc` prior to 4.8 do not have sufficiently complete C++11 support to build `ucg`.  `clang`/`clang++` is also known to work, but is not the primary development compiler.\n\n##### PCRE: `libpcre2-8` version 10.20 or greater, or `libpcre` version 8.21 or greater.\n\nOne or both of these should be available from your Linux/OS X/*BSD distro's package manager. You'll need the `-devel` versions if they're packaged separately.  Prefer `libpcre2-8`; while `ucg` will currently work with either PCRE2 or PCRE, you'll get better performance with PCRE2, and further development will be concentrated on PCRE2.\n\n\u003e #### OS X Prerequisites\n\u003e\n\u003e OS X additionally requires the installation of `argp-standalone`, which is normally part of the `glibc` library on Linux systems.  This can\n\u003e be installed along with a pcre2 library from Homebrew:\n\u003e ```sh\n\u003e $ brew update\n\u003e $ brew install pcre2 argp-standalone\n\u003e ```\n\n### Supported OSes and Distributions\n\nUniversalCodeGrep 0.3.3 should build and run on any reasonably POSIX-compliant platform where the prerequisites are available.  It has been built and tested on the following OSes/distros:\n\n- Linux:\n  - Fedora 23, 24, 25, 26\n  - Arch Linux\n  - Ubuntu 16.04 (Xenial), 14.04 (Trusty Tahr)\n- OS X:\n  - OS X 10.10, 10.11, 10.12, with Xcode 6.4, 7.3.1, 8gm, 8.1, and 8.2 resp.\n- *BSDs:\n  - TrueOS (nee PC-BSD) 12.0 (FreeBSD 12.0)\n- Windows:\n  - Windows 7 + Cygwin 64-bit\n\nNote that at this time, only x86-64/amd64 architectures are fully supported.  32-bit x86 builds are also occasionally tested.\n\n## Usage\n\nInvoking `ucg` is the same as with `ack` or `ag`:\n\n```sh\nucg [OPTION...] PATTERN [FILES OR DIRECTORIES]\n```\n\n...where `PATTERN` is a PCRE-compatible regular expression.\n\nIf no `FILES OR DIRECTORIES` are specified, searching starts in the current directory.\n\n### Command Line Options\n\nVersion 0.3.3 of `ucg` supports a significant subset of the options supported by `ack`.  In general, options specified later\non the command line override options specified earlier on the command line.\n\n#### Searching\n| Option | Description |\n|----------------------|------------------------------------------|\n| `--[no]smart-case`   | Ignore case if PATTERN is all lowercase (default: enabled). |\n| `-i, --ignore-case`  | Ignore case distinctions in PATTERN.                        |\n| `-Q, --literal`      | Treat all characters in PATTERN as literal.                 |\n| `-w, --word-regexp`  | PATTERN must match a complete word.                         |\n\n####  Search Output\n| Option | Description |\n|----------------------|------------------------------------------|\n| `--column`   | Print column of first match after line number. |\n| `--nocolumn` | Don't print column of first match (default).   |\n\n#### File presentation\n| Option | Description |\n|----------------------|------------------------------------------|\n| `--color, --colour`     | Render the output with ANSI color codes.    |\n| `--nocolor, --nocolour` | Render the output without ANSI color codes. |\n\n#### File/directory inclusion/exclusion:\n| Option | Description |\n|----------------------|------------------------------------------|\n| `--[no]ignore-dir=name, --[no]ignore-directory=name`     | [Do not] exclude directories with this name.        |\n| `--exclude=GLOB, --ignore=GLOB` | Files matching GLOB will be ignored. |\n| `--ignore-file=FILTER:FILTERARGS` |  Files matching FILTER:FILTERARGS (e.g. ext:txt,cpp) will be ignored. |\n| `--include=GLOB`                       | Only files matching GLOB will be searched. |\n| `-k, --known-types`                              | Only search in files of recognized types (default: on). |\n| `-n, --no-recurse`                               | Do not recurse into subdirectories.        |\n| `-r, -R, --recurse`                              | Recurse into subdirectories (default: on). |\n| `--type=[no]TYPE`                                | Include only [exclude all] TYPE files.  Types may also be specified as `--[no]TYPE`: e.g., `--cpp` is equivalent to `--type=cpp`.  May be specified multiple times. |\n\n#### File type specification:\n| Option | Description |\n|----------------------|------------------------------------------|\n| `--type-add=TYPE:FILTER:FILTERARGS` | Files FILTERed with the given FILTERARGS are treated as belonging to type TYPE.  Any existing definition of type TYPE is appended to. |\n| `--type-del=TYPE`                   | Remove any existing definition of type TYPE. |\n| `--type-set=TYPE:FILTER:FILTERARGS` | Files FILTERed with the given FILTERARGS are treated as belonging to type TYPE.  Any existing definition of type TYPE is replaced. |\n\n#### Performance Tuning:\n| Option | Description |\n|----------------------|------------------------------------------|\n| `--dirjobs=NUM_JOBS`   |  Number of directory traversal jobs (std::thread\u003c\u003es) to use.  Default is 2. |\n| `-j, --jobs=NUM_JOBS`       | Number of scanner jobs (std::thread\u003c\u003es) to use.  Default is the number of cores on the system. |\n\n#### Miscellaneous:\n| Option | Description |\n|----------------------|------------------------------------------|\n| `--noenv`         | Ignore .ucgrc files.                            |\n\n#### Informational options:\n| Option | Description |\n|----------------------|------------------------------------------|\n| `-?, --help`                      | give this help list                 |\n| `--help-types, --list-file-types` | Print list of supported file types. |\n| `--usage`                         | give a short usage message          |\n| `-V, --version`                   | print program version               |\n\n## Configuration (.ucgrc) Files\n\nUniversalCodeGrep supports configuration files with the name `.ucgrc`, in which command-line options can be stored on a per-user and per-directory-hierarchy basis.\n\n### Format\n\n`.ucgrc` files are text files with a simple format.  Each line of text can be either:\n\n1. A single-line comment.  The line must start with a `#` and the comment continues for the rest of the line.\n2. A command-line parameter.  This must be exactly as if it was given on the command line.\n\n### Location and Read Order\n\nWhen `ucg` is invoked, it looks for command-line options from the following locations in the following order:\n\n1. The `.ucgrc` file in the user's `$HOME` directory, if any.\n2. The first `.ucgrc` file found, if any, by walking up the component directories of the current working directory.  This traversal stops at either the user's `$HOME` directory or the root directory.  This is called the project config file, and is intended to live in the top-level directory of a project directory hierarchy.\n3. The command line itself.\n\nOptions read later will override earlier options.\n\n## User-Defined File Types\n\n`ucg` supports user-defined file types with the `--type-set=TYPE:FILTER:FILTERARGS` and `--type-add=TYPE:FILTER:FILTERARGS` command-line options.  Three FILTERs are currently supported, `ext` (extension list), `is` (literal filename), and `glob` (glob pattern).\n\n### Extension List Filter\n\nThe extension list filter allows you to specify a comma-separated list of file extensions which are to be considered as belonging to file type TYPE.\nExample:\n`--type-set=type1:ext:abc,xqz,def`\n\n### Literal Filename Filter\n\nThe literal filename filter simply specifies a single literal filename which is to be considered as belonging to file type TYPE.\nExample:\n`--type-add=autoconf:is:configure.ac`\n\n### Glob filter\n\nThe glob filter allows you to specify a glob pattern to match against filenames.  If the glob matches, the file is considered as belonging to the file type TYPE.\nExample:\n`--type-set=mk:glob:?akefile*`\n\n## Author\n\n[Gary R. Van Sickle](https://github.com/gvansickle)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgvansickle%2Fucg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgvansickle%2Fucg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgvansickle%2Fucg/lists"}