1 unstable release
0.1.0 | Nov 15, 2024 |
---|
#1291 in Command line utilities
5KB
89 lines
lilgrep
A miniature version of the grep command line tool built with Rust.
Search for a specific word within a file, and the entire line(s) containing that word will be returned to you.
Requirements:
- Must have Rust installed on your OS
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Basic usage
- Search for the word what within the file
poem.txt
:
cargo run what poem.txt
Case sensitivity
By default, the search is case sensitive.
If "What" exists but not the search query "what", nothing will be returned.
This is dependant upon this environment variable:
CASE_INSENSITIVE=
- To change this, all you need to do is run:
export CASE_INSENSITIVE=true
- To remove:
unset CASE_INSENSITIVE
Directing the output to a file
- Search for every case of "what" within
poem.txt
, and direct the result tooutput.txt
cargo run what poem.txt > output.txt