Skip to content

Instantly share code, notes, and snippets.

@dtuite
Last active December 19, 2015 21:19
Show Gist options
  • Save dtuite/6019512 to your computer and use it in GitHub Desktop.
Save dtuite/6019512 to your computer and use it in GitHub Desktop.
Example of using sed to find and replace recursively in a hierarchy of directories.
# http://stackoverflow.com/a/1583282/574190
find app/views -type f -print0 -name "*.erb" | xargs -0 sed -i '' 's/Et\.trac/mixpanel\.trac/g'
# Not sure why the following isn't equivilent.
sed =i '' 's/Et\.trac/mixpanel\.trac/g' app/views/**/*.html.erb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment