Giter VIP home page Giter VIP logo

gsub's Introduction

Gsub

A CLI program to do find and replace!

Installation

You can grab a binary release from the releases tab. Install it somewhere on your PATH.

Here's a one-liner:

$ curl -L https://github.com/rzane/gsub/releases/download/0.1.1/gsub-0.1.1_darwin_x86_64.tar.gz | tar xvf - -C /usr/local

Currently, binary releases are only available for Darwin. If you're on Linux, you'll have to build from source.

Usage

# Find occurances of `foo` in the current directory
$ gsub foo

# Find lines ending with `foo` in the current directory
$ gsub 'foo$'

# Find an replace all occurances of `foo` with `bar`
$ gsub foo --replace bar --commit

# Find an replace with backtracking
$ gsub 'foo (\w+) bar' --replace 'Got: \1' --commit

# Preview a find/replace (just omit the --commit)
$ gsub 'foo' --replace bar

# Find occurances of `foo` in the `app` and `lib` directories
$ gsub foo app lib

# Specify paths
$ gsub foo 'spec/**/*_spec.rb' 'app/**/*.rb'

# Exclude files from paths
$ gsub foo 'spec/**/*_spec.rb' --exclude 'spec/foo_spec.rb' --exclude 'spec/bar_*_spec.rb'

Development

To compile Gsub, you'll need Crystal. Instructions for your operating system can be found here: http://crystal-lang.org/docs/installation.

To build a release, simply run make.

Contributing

  1. Fork it ( https://github.com/rzane/gsub/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

gsub's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

gsub's Issues

emacs does dis


find . -type d \( -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o -path \*/MCVS -o -path \*/.src -o -path \*/.svn -o -path \*/.git -o -path \*/.hg -o -path \*/.bzr -o -path \*/_MTN -o -path \*/_darcs -o -path \*/\{arch\} \) -prune -o \! -type d \( -name .\#\* -o -name \*.o -o -name \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name \*.a -o -name \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o -name \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name \*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name \*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name \*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o -name \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name \*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name \*.sx64fsl -o -name \*.sx32fsl -o -name \*.wx64fsl -o -name \*.wx32fsl -o -name \*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name \*.dxl -o -name \*.lo -o -name \*.la -o -name \*.gmo -o -name \*.mo -o -name \*.toc -o -name \*.aux -o -name \*.cp -o -name \*.fn -o -name \*.ky -o -name \*.pg -o -name \*.tp -o -name \*.vr -o -name \*.cps -o -name \*.fns -o -name \*.kys -o -name \*.pgs -o -name \*.tps -o -name \*.vrs -o -name \*.pyc -o -name \*.pyo \) -prune -o  -type f \( -iname \*.cr \) -exec grep -i -nH -e foo {} +

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.