Ferris Find is a simple command-line tool for searching text in files, built with Rust. It's an implementation of the minigrep project from the official Rust book, demonstrating core Rust concepts in a practical application.
This project showcases fundamental Rust programming concepts:
- Command-line argument parsing
- File I/O operations
- Error handling
- Environment variables
- String searching and filtering
Search for a query string in a file and print matching lines to the console:
cargo run -- to poem.txtSearch for a query string and redirect the results to an output file:
cargo run -- to poem.txt > output.txtcargo run -- <query> <filename><query>: The text string to search for<filename>: The file to search within
- Rust (latest stable version recommended)
- Cargo
- Clone the repository:
git clone https://github.com/devwraithe/ferris-find.git
cd ferris-find- Build the project:
cargo build- Run the tool:
cargo run -- <query> <filename>Given a poem.txt file with the following content:
I'm nobody! Who are you?
Are you nobody, too?
Then there's a pair of us - don't tell!
Running:
cargo run -- you poem.txtWill output:
I'm nobody! Who are you?
Are you nobody, too?