Skip to content
/ Grep Public

This Rust-based Text Search Tool empowers users to efficiently search for specific patterns within files and directories. Whether you need to find text within documents, explore directories, or perform advanced search operations, this versatile tool has you covered.

Notifications You must be signed in to change notification settings

amiralv82/Grep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Creating a comprehensive README for your GitHub repository is crucial for helping users understand your code, its purpose, and how to use it effectively. Below, I've provided a template for your README based on your code and the options you've implemented. Remember to replace placeholders with actual content:

Text Search Tool

This is a versatile text search tool developed in Rust that allows you to search for specific patterns in files and directories. It offers various search options, including case-insensitive searching, non-matching results, and the ability to search within directories.

Table of Contents

Features

  • Search for patterns in files and directories.
  • Option for case-insensitive searching.
  • Find files that do not match the specified pattern.
  • Search within directories and their contents.
  • Define search depth within directories.
  • Parallel searching using multiple threads.
  • Utilizes the regex and walkdir crates.
  • Easy-to-use command-line interface.

Prerequisites

Before using this tool, ensure you have the following prerequisites:

Usage

Clone the repository and build the tool using the following commands:

git clone https://github.com/yourusername/text-search-tool.git
cd text-search-tool
cargo build --release

Run the tool with the desired options:

cargo run [OPTIONS] PATTERN [FILE/DIRECTORY]

Configuration Options

The tool supports various options that customize your search. These options are specified as environment variables:

  • IC: Perform case-insensitive searching.
  • NON: Find files and lines that do not match the pattern.
  • DIR: Search inside directories and find only files with the pattern.
  • IN: Search inside files found in directories.
  • DPT:[1..n]: Specify the search depth through directories (default is 1).
  • TH: Enable parallel searching.
  • NT:[1..n]: Specify the number of threads for parallel searching (default is 6).

Examples

Basic Usage

Search for the pattern "example" in a file:

cargo run example path/to/yourfile.txt

Case-Insensitive Search

Perform a case-insensitive search for "example" in a file:

IC=1 cargo run example path/to/yourfile.txt

Non-Matching Results

Find lines in a file that do not contain "example":

NON=1 cargo run example path/to/yourfile.txt

Search in Directories

Search for files containing "example" within a directory:

DIR=1 cargo run example path/to/yourdirectory

Search Inside Files in Directories

Search inside files found in directories:

IN=1 cargo run example path/to/yourdirectory

Parallel Searching

Enable parallel searching with a specified number of threads:

TH=1 NT:4 cargo run example path/to/yourdirectory

About

This Rust-based Text Search Tool empowers users to efficiently search for specific patterns within files and directories. Whether you need to find text within documents, explore directories, or perform advanced search operations, this versatile tool has you covered.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages