/mini-grep

A Simple implementation of GREP (global regular expression print) in the Rust Programming Language

Primary LanguageRust

MINI-GREP

This is a command-line utility that implements the grep command in Rust. It allows you to search for a pattern in one or more files and print the matching lines.

Installation

To install the utility, you need to have Rust and Cargo installed on your system. If you don't have them installed already, you can download and install them from the official Rust website: https://www.rust-lang.org/tools/install.

Once you have Rust and Cargo installed, you can clone this repository and build the project using the following commands:

git clone https://github.com/deepak-likes-code/mini-grep.git
cd mini-grep
cargo build --release

The --release flag tells Cargo to build the project with optimizations enabled, which should result in a faster executable.

Usage

To use the mini-grep utility, run the following command:

<IGNORE_CASE=1> cargo run <pattern> <file>

Replace <pattern> with the pattern you want to search for, and <file(s)> with the name(s) of the file(s) you want to search in. You can specify multiple files by separating them with spaces.

For example, to search for the word "hello" in a file called example.txt, you would run the following command:

cargo run hello example.txt

This would print all the lines in example.txt that contain the word "hello".

Contributing

If you would like to contribute to this project, feel free to fork the repository and submit a pull request. Before submitting a pull request, please make sure your code follows the Rust code style guidelines and passes all the tests.

License

This project is licensed under the MIT License. See the LICENSE file for details.