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.
- 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.
Before using this tool, ensure you have the following prerequisites:
- Rust and Cargo: Installation Instructions
- Git: Installation Instructions
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 --releaseRun the tool with the desired options:
cargo run [OPTIONS] PATTERN [FILE/DIRECTORY]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).
Search for the pattern "example" in a file:
cargo run example path/to/yourfile.txtPerform a case-insensitive search for "example" in a file:
IC=1 cargo run example path/to/yourfile.txtFind lines in a file that do not contain "example":
NON=1 cargo run example path/to/yourfile.txtSearch for files containing "example" within a directory:
DIR=1 cargo run example path/to/yourdirectorySearch inside files found in directories:
IN=1 cargo run example path/to/yourdirectoryEnable parallel searching with a specified number of threads:
TH=1 NT:4 cargo run example path/to/yourdirectory