Skip to content

Instantly share code, notes, and snippets.

@thisivan
Created February 9, 2010 07:55
Show Gist options
  • Save thisivan/299008 to your computer and use it in GitHub Desktop.
Save thisivan/299008 to your computer and use it in GitHub Desktop.
# Replace text in files using regular expressions
# test your search
find . | xargs grep ':precision => 2, :scale => 14' -l
# replace text
find db/migrate -type f -name "*" -exec sed -i -e "s/:precision => 2, :scale => 14/:precision => 14, :scale => 2/g" "{}" \;
# test your results
grep ":precision => 2, :scale => 14" db/migrate/. -R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment