Coder Social home page Coder Social logo

grip's Introduction

grip

Indexed grep - fast search (grep like) in huge stack of files.

Author: Mike Szymaniak

Features

  • fast search for pattern in text files;
  • intended mainly (but not limited to) source code;
  • support for Huge Blobs of Legacy Code™;
  • language & encoding agnostic (excluding UTF-16);
  • search with regex (basic and extended) or fixed string;
  • case sensitive and case insensitive search;
  • search limited to current subdirectory;
  • context line control (greps -B, -A and -C switches);
  • colored output.

Limitations

  • index must be generated prior to search;
  • and it must be up to date with files content;
  • some regular expressions are too convoluted to lookup into index;
  • only limited greps switches are implemented;
  • search pattern is assumed to be encoded the same way as searched files (usually not the case for ASCII characters, e.g. source code).

Requirements

  • C++11 compiler (e.g. GCC 4.8+ or Clang 3.4+);
  • Boost library: regex, filesystem and system.

Compilation

Assuming above requirements are met

mkdir build
cd build
cmake ..
make
make install

For more information see installation guide

Usage

First we need to generate index database. Under POSIX system:

find . -type f | gripgen

Or under Windows:

dir /b /s /a:-d | gripgen

It will create database directory .grip. Binary files (these containing zero byte) will be ignored. In case of great number of files, this step will take some time. Indexer typically process 100 to 1000 files per second, and the resulting database size will be about 10% of the indexed data.

You could also provide file list to index

gripgen list.txt

Indexed files must be located inside current directory and its subdirectories.

Now you could perform search, e.g.:

grip printf
grip -E '(foo|bar)-[a-z]*'
grip -i -C3 'hello world'
grip --list main

For more usage information type grip --help.

grip's People

Contributors

sc0ty avatar tex avatar

Watchers

 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.