Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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)

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
```



🙆‍♂️🙆‍♂️🙆‍♂️