Skip to content

MrDonkey08/minigrep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minigrep

Rust implementation for grep tool from "The Rust Programming Language" book

Table of Contents

Disclaimer

This is just an implementation for educational purposes. This implementation can only search a string (in case sensitive or insensitive) within a single file. It shows all the line that contain the given string.

For a full rust implementation see the ripgrep (rg) tool.

Usage

You can build and run this CLI tool with the following syntax:

cargo run --release -- STRING FILE

Where STRING is the text to find and FILE is the path to the file

Alternatively, you can build the CLI tool and execute the binary directly, executing the following commands:

cargo build --release
cd target/release
./minigrep STRING FILE

Case insensitive search

For performing a case insensitive search, you need to create the IGNORE_CASE env variable, for example:

 # To create the temp env var and then execute the tool
IGNORE_CASE=1 cargo run --release -- STRING FILE

 # To create the "permanent" env var and then execute the tool
export IGNORE_CASE=1 && cargo run --release -- STRING FILE

Test run

You can run the test using the following command:

cargo test --release

About

Rust implementation for grep tool from "The Rust Programming Language" book

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages