Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jiisanda/minigrep
Classic command line search tool grep (globally search a regular expression and print)
https://github.com/jiisanda/minigrep
Last synced: about 7 hours ago
JSON representation
Classic command line search tool grep (globally search a regular expression and print)
- Host: GitHub
- URL: https://github.com/jiisanda/minigrep
- Owner: jiisanda
- License: mit
- Created: 2023-07-13T16:49:07.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-18T06:33:35.000Z (over 1 year ago)
- Last Synced: 2023-07-19T06:48:20.557Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# minigrep
Classic command line search tool `grep` (`g`lobal search `r`egular `e`xpression and `p`rint).
In the simplest use case, `grep` searches a specified file for a specified string.
Reference: Chapter 12 of The Book: [chap12](https://doc.rust-lang.org/book/ch12-00-an-io-project.html)
### Build
```
$ git clone https://github.com/jiisanda/minigrep.git
$ cargo build
```### Running Tests
```
$ cargo tests
```### Searching
```
$ cargo run --
```
This will get the output in the terminal. If the output is expected in output.txt file.
```
$ cargo run -- > ../output.txt
```### For Case Sensitive Searching
For case sensitive searching, environment variables are used...
```
$ IGNORE_CASE=1 cargo run --
```In case of Powershell:
```
PS> $Env:IGNORE_CASE=1; cargo run --
```
This will make `IGNORE_CASE` persist for the remainder of the shell session. It can be unset with `Remove-Item` cmdlet:
```
PS> Remove-Item Env:IGNORE_CASE
```
🙆♂️🙆♂️🙆♂️