Skip to main content

An enhanced grep-like tool

Project description

Grepy

Grepy is an enhanced grep-like tool built in Python that extends the functionality of traditional grep with additional features for more efficient and powerful text searching.

Features

  • All standard grep functionality: Case-insensitive search, recursive search, invert matching, line numbers, word boundaries, etc.
  • Enhanced display: Highlighted matches, colored output for easy reading
  • Performance options: Parallel processing for faster searches on multiple files
  • Advanced search: File filtering with include/exclude patterns, directory exclusion
  • Customizable output: Sort results, limit results count, show column numbers
  • Detailed information: Summary statistics, verbose mode for debugging
  • Portable: Works on any platform that supports Python 3.6+

Installation

pip install grepy-tool

Usage

Basic usage:

grepy "pattern" file.txt

Search in all files in current directory:

grepy "pattern" .

Recursive search with highlighting:

grepy "pattern" --recursive --highlight .

Case-insensitive search with line numbers:

grepy -i -n "pattern" file.txt

Advanced example:

grepy "function" --recursive --highlight --summary --include="*.py" --exclude="*test*" .

Options

Standard grep options:

  • -i, --ignore-case: Case insensitive search
  • -r, --recursive: Search directories recursively
  • -v, --invert-match: Show lines that do not match
  • -n, --line-numbers: Show line numbers
  • -w, --word: Match whole words only
  • -m, --max-count NUM: Stop after NUM matches

Enhanced features:

  • -p, --parallel: Use parallel processing for faster searches
  • --workers NUM: Number of worker threads for parallel processing
  • --highlight: Highlight matching text
  • --no-color: Disable colored output
  • --sort: Sort results by filename
  • --column: Show column number of match
  • --first-only: Only show first match per file
  • --summary: Show summary of matches
  • --multiline: Enable multiline regex matching
  • --include GLOB: Only search files matching GLOB pattern
  • --exclude GLOB: Skip files matching GLOB pattern
  • --exclude-dir GLOB: Skip directories matching GLOB pattern
  • --filename: Always show filename
  • --verbose: Enable verbose output

Python API

Grepy can also be used as a Python library:

from grepy.grepy import Grepy

# Create a grepy instance
grepy = Grepy()

# Search with options
matches = grepy.search(
    "pattern",
    ["file.txt", "directory"],
    {
        "recursive": True,
        "ignore_case": True,
        "highlight": True
    }
)

# Process results
for match in matches:
    print(f"{match.filename}:{match.line_number}: {match.line}")

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grepy_tool-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grepy_tool-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file grepy_tool-0.1.0.tar.gz.

File metadata

  • Download URL: grepy_tool-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for grepy_tool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8cfdd79192b48b47702941ab7e7e01ef2c24ca861ac6efff570027aec8287ea
MD5 92b72a64151cea0321d0c5f055076fbc
BLAKE2b-256 31ad092975187a4f92d29b5f818aa78acf08c2258a8b523bead90af52ad19449

See more details on using hashes here.

File details

Details for the file grepy_tool-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: grepy_tool-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for grepy_tool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a8fbd16c1c15fa60c2e17e7802796565637c7927a886fda176ca811ef273e5d8
MD5 8f8f8f3b007a94cfc2decd9d141c3d48
BLAKE2b-256 36626c7669316f37580ebc30f5e19773a551b127f28199a8e9bede14e7d410f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page