A toy re-implementation of GNU Grep by Rust.

Overview

Mini Grep

Mini Grep is a simple rust re-implementation of GNU Grep, which means it could just implement limited functions, such as searching specific string in .txt file (Actually I have supply a test example, peter.txt).

Setup

Requirement

Because this program is written by Rust, and should be built by Cargo, Please check your requirements first before setting up.

Type following command to check Cargo:

$ cargo --version

Build

Type following script in your Terminal to build Mini Grep.

$ git clone https://github.com/PeterWrighten/mini_grep_rust.git

$ cd mini_grep_rust

$ cargo build

Mini Grep

Mini Grep has following features:

1. Search string in file: Case insensitive or not.

$ [CASE_INSENSITIVE=?] cargo run [query string] [filename]

You could test this by use my test file: peter.txt.

Example

Case insensitive search:

$ CASE_INSENSITIVE=1 cargo run am peter.txt

Case sensitive search:

$ cargo run am peter.txt

2. Output results into .txt file in root directory without error.

$ [CASE_INSENSITIVE=?] cargo run [query string] [filename] > [output filename]

Example

Stdout:

$ CASE_INSENSITIVE=1 cargo run am peter.txt > container.txt

Error:

$ cargo run > container.txt

Reference

  1. GNU Grep
  2. Rust Programming Languages
  3. A TTD Example in Rust
You might also like...
Fuzzy Finder in rust!
Fuzzy Finder in rust!

Life is short, skim! Half of our life is spent on navigation: files, lines, commands… You need skim! It is a general fuzzy finder that saves you time.

A bash-like Unix shell written in Rust

Cicada Unix Shell Cicada is a simple Unix shell written in Rust. Documents Install cicada Environment Variables Cicada Builtins Completion RC File His

Performs distributed command execution, written in Rust w/ Tokio

Concurr: Distributed and Concurrent Command Execution, in Rust This project is dual licensed under MIT and Apache 2.0. Originally inspired by the GNU

A library to listen to global hotkeys in Rust

Rust Hotkey A library to listen to global hotkeys in Rust How to use See the examples folder for how to use this library. OS Support This lib aims to

🔮 Futuristic take on hexdump, made in Rust.
🔮 Futuristic take on hexdump, made in Rust.

hex (hx) Futuristic take on hexdump. hx accepts a file path as input and outputs a hexadecimal colorized view to stdout. $ hx tests/files/alphanumeric

A TUI system monitor written in Rust
A TUI system monitor written in Rust

NO LONGER MAINTAINED. For a similar program, check out https://github.com/ClementTsang/bottom. ytop Another TUI based system monitor, this time in Rus

A rust layered configuration loader with zero-boilerplate configuration management.

salak A layered configuration loader with zero-boilerplate configuration management. About Features Placeholder Key Convension Cargo Features Default

Untrusted IPC with maximum performance and minimum latency. On Rust, on Linux.

Untrusted IPC with maximum performance and minimum latency. On Rust, on Linux. When is this Rust crate useful? Performance or latency is crucial, and

An over-engineered rewrite of pipes.sh in Rust
An over-engineered rewrite of pipes.sh in Rust

pipes-rs An over-engineered rewrite of pipes.sh in Rust Installlation macOS Install using Homebrew or download manually from releases. $ brew install

Releases(v1.0)
Owner
PeterWrght
“Hard Work Beats Talent When Talent Doesn’t Work Hard.”
PeterWrght
A crate implementing POSIX/GNU-style --flags.

pflag is a port of the spf13's popular fork of the Go package by the same name.

null 11 Jul 21, 2022
like ~~grep~~ UBER, but for binaries

bingrep Greps through binaries from various OSs and architectures, and colors them. Current backends: ELF 32/64, arm, x86, openrisc - all others will

null 1.6k Jan 1, 2023
Rust implementation to simply convert between coordinate systems

GeoMorph Simple conversion between different coordinate systems without external wrappers

Victor Lopes 10 Nov 8, 2022
A client-side gRPC channel implementation for tonic

ginepro ginepro provides client-side gRPC load-balancing out of the box by enriching tonic ‘s channel with periodic service discovery. Overview ginepr

TrueLayer 92 Jan 3, 2023
minimalistic command launcher in rust

rrun Note: Apart from the occasional fix, this project is not actively developed anymore. rrun works fine and should run/compile for the time being on

null 105 Nov 18, 2022
Yet another fancy watcher. (Rust)

funzzy Yet another fancy watcher. (Inspired by antr / entr) Configure execution of different commands using semantic yaml. # .watch.yaml # list here a

Cristian Oliveira 188 Dec 12, 2022
A modern replacement for ps written in Rust

procs procs is a replacement for ps written in Rust. Documentation quick links Features Platform Installation Usage Configuration Features Output by t

null 3.6k Jan 5, 2023
A more intuitive version of du in rust

Dust du + rust = dust. Like du but more intuitive. Why Because I want an easy way to see where my disk is being used. Demo Install Cargo cargo install

andy.boot 5.5k Jan 8, 2023
Blazing 💥 fast terminal-ui for git written in rust 🦀

Blazing fast terminal client for git written in Rust Features Fast and intuitive keyboard only control Context based help (no need to memorize tons of

Stephan Dilly 11.8k Jan 5, 2023
A simple and fast download accelerator, written in Rust

zou A simple and fast download accelerator, written in Rust Zou is a Snatch fork by @k0pernicus. Snatch is a fast and interruptable download accelerat

Antonin Carette 173 Dec 4, 2022