Skip to content
This repository has been archived by the owner on Sep 17, 2022. It is now read-only.
/ perg Public archive

A small command-line tool to search for given string inside a file, aka light-weight grep, written in Rust

License

Notifications You must be signed in to change notification settings

vinhnx/perg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

perg

https://crates.io/crates/perg

A micro lightweight implementation of grep, written in Rust.

It's mainly for my journey to learn Rust programming language and its fascinated ecosystem, but feel free to use it. 😄

❯ perg --help
perg x.x.x
Vinh Nguyen <>
perg is a small command-line tool to search for given string inside a file

USAGE:
    perg [FLAGS] <PATTERN> <FILE>

FLAGS:
    -h, --help           Prints help information
    -i, --ignore-case    Perform case insensitive matching. Default is case sensitive.
    -V, --version        Prints version information

ARGS:
    <PATTERN>    pattern to search, can use regular expression
    <FILE>       path to file

Usage

a test.md is included in this repo:

$ cat test.md
hello world hi world bye world end of file Title

to try out perg on the included test.md file:

$ perg h test.md
    # hello world
    # hi world

perg also support regular expression search, like grep:

$ perg "h[ei]" test.md
    # hello world
    # hi world

$ perg "hello|bye" test.md
    # hello world
    # bye world

$ perg "^(be)" test.md
    # bye world
    # end of file

case insensitive search:

$ perg -i I test.md
    # hi world
    # end of file

Installation

Using Cargo via rustup:

$ curl https://sh.rustup.rs -sSf | sh

then install perg binary:

$ cargo install perg

NOTE: if you see error "cargo command not found", it is because cargo executable is not yet added to your .bashrc/.zshrc yet. To mitigate this, just restart your Terminal/iTerm and it run cargo install perg again, should it fine.

Rust Books 🦀

As of now, Rust is one the most favorited programming according to StackOverflow. 🎁

Help, feedback or suggestions?

Feel free to contact me on Twitter for discussions, news & announcements & other projects. 🚀

What's with the name?

Glad you asked, perg is just the reversed of grep.

About

A small command-line tool to search for given string inside a file, aka light-weight grep, written in Rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages