Skip to content

Instantly share code, notes, and snippets.

@thisivan
Created January 19, 2010 19:04
Show Gist options
  • Save thisivan/281173 to your computer and use it in GitHub Desktop.
Save thisivan/281173 to your computer and use it in GitHub Desktop.
Replace Text in Files with Sed
# Replace text in files using regular expressions:
find db/migrate -type f -name "*" -exec sed -i -e "s/:precision => 2, :scale => 14/:precision => 14, :scale => 2/g" "{}" \;
# Find replacements made:
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