scatterd-dotfiles/bin/replace

13 lines
213 B
Text
Raw Normal View History

#!/bin/sh
#
# Find and replace by a given list of files.
#
# replace foo bar **/*.rb
2015-07-28 21:20:01 -04:00
find_this="$1"
shift
2015-07-28 21:20:01 -04:00
replace_with="$1"
shift
2015-07-28 21:20:01 -04:00
ag -l --nocolor "$find_this" $* | xargs sed -i '' "s/$find_this/$replace_with/g"