scatterd-dotfiles/bin/replace
Gabe Berke-Williams 1f4e6d1370 Use ag instead of ack
https://github.com/ggreer/the_silver_searcher

* ag is faster than ack
* ag searches all files by default (but still ignores gitignored files). This
  removes the need for ack's `--type-add=` options.
* The command is 33% shorter than ack!
2013-03-01 23:28:36 -05:00

12 lines
197 B
Bash
Executable file

#!/bin/sh
#
# Find and replace by a given list of files.
#
# replace foo bar **/*.rb
find_this=$1
shift
replace_with=$1
shift
ag -l $find_this $* | xargs sed -i '' "s/$find_this/$replace_with/g"