Skip to content

Recreating basic grep functionalities in Rust. Part of The Rust Book

License

Notifications You must be signed in to change notification settings

edusporto/rust-grep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-grep

Recreating basic grep functionalities in Rust. Exercise part of The Rust Book.

Building

To build this program you will need to have installed the Rust Programming Language. For a tutorial on this, check https://www.rust-lang.org/tools/install.

Running cargo build --release will build the binary in the target/release directory. Alternatively, you can build the binary and run it at the same time using cargo run --release.

Usage

./rust-grep query [file name]

  • query - The query that will be searched for in the specified stream.
  • [file name] - OPTIONAL - If specified, the program will search for the query in the given file. If not, the program will search the query in the terminal's standard output.
  • If the CASE_INSENSITIVE environment variable is set, the program will search for the query as case insensitive.

Examples:

  • ./rust-grep "nevermore" theraven.txt
  • cat theraven.txt | ./rust-grep "nevermore"
  • CASE_INSENSITIVE=1 ./rust-grep raven theraven.txt

About

Recreating basic grep functionalities in Rust. Part of The Rust Book

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages