Coder Social home page Coder Social logo

grep's Introduction

Cross-platform grep implementation

This project sought to be a cross-platform utility compatible with some basic features of GNU grep. It is written in Go so that it can be easily built for Windows, but at the cost of GNU grep's excellent performance.

It currently supports a few of the short command-line flags from GNU grep, and uses Go's regular expressions.

Compiling / Installation

For simple installation, just run go install github.com/yalue/grep. Alternatively, download links for Windows can be found on the releases page.

Usage

Basic usage: grep [flags] <expression> [file paths]. If no file paths are provided, the program will read from standard input.

The regular expression supports Go's regular expression syntax. The file path accepts wildcards, and will be expanded according to Go's filepath.Glob(). Running the program with the --help argument will display usage information. The following flags are supported, with behavior identical to GNU grep:

  • -i: Perform case-insensitive matching.

  • -r: Recursively scan files in all directories matching the given filepaths.

  • -v: Print the inverse of each match; don't include lines which did match.

  • -o: Print only the portion of each line which matched the regular expression. The default behavior is to print the entire matching line.

  • -h: Never show filenames for matching lines. This is the default if only one file (or standard input) is being scanned.

  • -H: Always show filenames for matching lines. This is the default if more than one file is being scanned.

  • -a: Treat binary files as text files. The default behavior will simply print a message if a matching line is found in a binary file. Any file containing a null byte is counted as "binary".

grep's People

Contributors

yalue avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.