Combining both find
and sed
to find and replace words
find app db spec -type f \( -name '*.rb' -o -name '*.sql' \) -exec sed -i '' -e 's/dollar_value/budget_value/g' {} \;
This script:
- searches in the
app
,db
, andspec
directories - it only looks at file types that are either
.rb
or.sql
files